[wasm-shape] Don't crash if font is bad

This commit is contained in:
Behdad Esfahbod 2023-03-02 10:29:01 -07:00
parent 7df9b3dd89
commit 74a2f338c6
1 changed files with 5 additions and 0 deletions

View File

@ -425,6 +425,11 @@ retry:
{
DEBUG_MSG (WASM, module_inst, "Calling shape() failed: %s",
wasm_runtime_get_exception (module_inst));
if (!buffer->ensure_unicode ())
{
DEBUG_MSG (WASM, font, "Shape failed but buffer is not in Unicode; failing...");
goto fail;
}
if (retried)
{
DEBUG_MSG (WASM, font, "Giving up...");