diff --git a/src/library_exceptions.js b/src/library_exceptions.js index b5f9e084e6832..9ea9eb0ffa34f 100644 --- a/src/library_exceptions.js +++ b/src/library_exceptions.js @@ -279,12 +279,16 @@ var LibraryExceptions = { var pointer = {{{ exportedAsmFunc('___cxa_is_pointer_type') }}}(throwntype); // can_catch receives a **, add indirection - if (!___cxa_find_matching_catch.buffer) ___cxa_find_matching_catch.buffer = _malloc(4); #if EXCEPTION_DEBUG out("can_catch on " + [thrown]); #endif - {{{ makeSetValue('___cxa_find_matching_catch.buffer', '0', 'thrown', '*') }}}; - thrown = ___cxa_find_matching_catch.buffer; +#if DISABLE_EXCEPTION_CATCHING == 1 + var buffer = 0; +#else + var buffer = {{{ makeStaticAlloc(4) }}}; +#endif + {{{ makeSetValue('buffer', '0', 'thrown', '*') }}}; + thrown = buffer; // The different catch blocks are denoted by different types. // Due to inheritance, those types may not precisely match the // type of the thrown object. Find one which matches, and