check for nil signal in #handle:do:
authorClaus Gittinger <cg@exept.de>
Thu, 23 Aug 2001 23:03:04 +0200
changeset 5931 9e40d7255c26
parent 5930 d7728046c2e1
child 5932 6041c11b3370
check for nil signal in #handle:do: otherwise, we get a recursive error in the handler, when it tries to send it #accepts:
Block.st
--- a/Block.st	Thu Aug 23 23:00:58 2001 +0200
+++ b/Block.st	Thu Aug 23 23:03:04 2001 +0200
@@ -496,6 +496,15 @@
     ^ nargs
 ! !
 
+!Block methodsFor:'binary storage'!
+
+storeBinaryDefinitionOn:stream manager:manager
+    byteCode isNil ifTrue:[
+        self halt:'cannot preserve semantics of block'.
+    ].
+    ^ super storeBinaryDefinitionOn:stream manager:manager
+! !
+
 !Block methodsFor:'conversion'!
 
 asVarArgBlock
@@ -1123,6 +1132,11 @@
 
     theContext selector == #on:do: ifTrue:[
         sig := theContext argAt:1.
+        sig isNil ifTrue:[
+            'oops - nil arg in on:do:-context (undefined Exception)' errorPrintCR.
+            theContext fullPrint.
+            ^ nil.
+        ].
         (sig == signal or:[sig accepts:signal]) ifTrue:[
             handler := theContext argAt:2.
             "/ this is for backward compatibility when no ex-arg
@@ -1778,6 +1792,6 @@
 !Block class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.101 2001-01-10 12:52:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.102 2001-08-23 21:03:04 cg Exp $'
 ! !
 Block initialize!