macroquad icon indicating copy to clipboard operation
macroquad copied to clipboard

Calling `load_file` from wasm on a nonexistant file crashes (Firefox)

Open rileylyman opened this issue 3 years ago • 0 comments

It seems that the WASM crashes when you try to call load_file on a file that doesn't exist.

Reproduction repo: https://github.com/rileylyman/load_file_repro/

use macroquad::prelude::*;

#[macroquad::main("Foo")]
async fn main() {
    info!("before load_file on foo.txt");
    let result = load_file("foo.txt").await;
    info!("got {:?}", result);

    info!("before load_file on nonexistant.txt");
    let result = load_file("nonexistant.txt").await;
    info!("got {:?}", result);
}

Natively (on WSL), this produces the following output: native_repro

But when served to Firefox, this produces: wasm_repro

As you can see, the last info! statement is never exectuted in the latter case.

rileylyman avatar Sep 05 '22 20:09 rileylyman