macroquad
macroquad copied to clipboard
Calling `load_file` from wasm on a nonexistant file crashes (Firefox)
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:

But when served to Firefox, this produces:

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