summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/exception.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/exception.cc b/src/exception.cc
index 9cff21b..bc4cd02 100644
--- a/src/exception.cc
+++ b/src/exception.cc
@@ -864,10 +864,13 @@ extern "C" void *__cxa_begin_catch(void *e)
__cxa_exception *ex = (__cxa_exception*)
((char*)exceptionObject - offsetof(struct __cxa_exception, unwindHeader));
- // Add this to the front of the list of exceptions being handled and
- // increment its handler count so that it won't be deleted prematurely.
- ex->nextException = globals->caughtExceptions;
- globals->caughtExceptions = ex;
+ if (ex->handlerCount == 0)
+ {
+ // Add this to the front of the list of exceptions being handled and
+ // increment its handler count so that it won't be deleted prematurely.
+ ex->nextException = globals->caughtExceptions;
+ globals->caughtExceptions = ex;
+ }
if (ex->handlerCount < 0)
{