(web) add explicit check for failure to create context

This commit is contained in:
Nick Fisher
2025-05-28 21:54:03 +08:00
parent ff5921a505
commit ffc7717149

View File

@@ -44,6 +44,11 @@ extern "C"
attr.majorVersion = 2;
auto context = emscripten_webgl_create_context("#thermion_canvas", &attr);
if(!context) {
std::cout << "Failed to create WebGL context" << std::endl;
return context;
}
std::cout << "Created WebGL context " << attr.majorVersion << "." << attr.minorVersion << std::endl;