From 1757b8466dc0b5d81319e1100933122f5e1b1a5a Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 18 Nov 2015 14:42:13 +0100 Subject: [PATCH] fixes #3546 --- compiler/vm.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/vm.nim b/compiler/vm.nim index afc003452..0e63daf89 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -255,9 +255,12 @@ proc cleanUpOnException(c: PCtx; tos: PStackFrame): nextExceptOrFinally = pc2 + c.code[pc2].regBx - wordExcess inc pc2 while c.code[pc2].opcode == opcExcept: - let exceptType = c.types[c.code[pc2].regBx-wordExcess].skipTypes( + let excIndex = c.code[pc2].regBx-wordExcess + let exceptType = if excIndex > 0: c.types[excIndex].skipTypes( abstractPtrs) - if inheritanceDiff(exceptType, raisedType) <= 0: + else: nil + #echo typeToString(exceptType), " ", typeToString(raisedType) + if exceptType.isNil or inheritanceDiff(exceptType, raisedType) <= 0: # mark exception as handled but keep it in B for # the getCurrentException() builtin: c.currentExceptionB = c.currentExceptionA