summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/system.nim5
-rwxr-xr-xlib/system/excpt.nim6
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 579cbbc58..b4e552701 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1941,6 +1941,7 @@ when not defined(EcmaScript) and not defined(NimrodVM):
       prev: PSafePoint # points to next safe point ON THE STACK
       status: int
       context: C_JmpBuf
+      hasRaiseAction: bool
       raiseAction: proc (e: ref E_Base): bool {.closure.}
   
   when defined(initAllocator):
@@ -2047,7 +2048,9 @@ when not defined(EcmaScript) and not defined(NimrodVM):
       ## raise an exception but instead calls ``action``.
       ## If ``action`` returns false, the exception has been handled and
       ## does not propagate further through the call stack.
-      if not isNil(excHandler): excHandler.raiseAction = action
+      if not isNil(excHandler):
+        excHandler.hasRaiseAction = true
+        excHandler.raiseAction = action
 
   {.push stack_trace: off, profiler:off.}
   when defined(endb):
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index 176395975..fa2622435 100755
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -51,8 +51,8 @@ proc popFrame {.compilerRtl, inl.} =
 proc setFrame(s: PFrame) {.compilerRtl, inl.} =
   framePtr = s
 
-proc pushSafePoint(s: PSafePoint) {.compilerRtl, inl.} = 
-  s.raiseAction = nil
+proc pushSafePoint(s: PSafePoint) {.compilerRtl, inl.} =
+  s.hasRaiseAction = false
   s.prev = excHandler
   excHandler = s
 
@@ -199,7 +199,7 @@ proc raiseExceptionAux(e: ref E_Base) =
   if globalRaiseHook != nil:
     if not globalRaiseHook(e): return
   if excHandler != nil:
-    if isNil(excHandler.raiseAction) or excHandler.raiseAction(e):
+    if not excHandler.hasRaiseAction or excHandler.raiseAction(e):
       pushCurrentException(e)
       c_longjmp(excHandler.context, 1)
   elif e[] of EOutOfMemory: