commonSuperClass: care for nil subclass
authorClaus Gittinger <cg@exept.de>
Thu, 12 Sep 2002 11:13:07 +0200
changeset 6754 d9c0f178f091
parent 6753 1a4a541850f2
child 6755 a5704d23e08f
commonSuperClass: care for nil subclass
Behavior.st
--- a/Behavior.st	Wed Sep 11 19:28:21 2002 +0200
+++ b/Behavior.st	Thu Sep 12 11:13:07 2002 +0200
@@ -3190,17 +3190,20 @@
 
 commonSuperclass:aClass
     "Return the common superclass of the receiver and aClass.
-     Assumes that there is a common superclass of any two classes."
+     Assumes that there is a common superclass of any two classes.
+     (might return nil, if either the receiver or the argument inherit from nil)"
 
     (aClass includesBehavior:self) ifTrue:[^ self].
     (self inheritsFrom:aClass) ifTrue:[^ aClass].
-    ^ self superclass commonSuperclass:aClass
+    superclass isNil ifTrue:[^ nil].
+    ^ superclass commonSuperclass:aClass
 
     "
      Integer commonSuperclass:Fraction  
      SmallInteger commonSuperclass:Fraction  
      View commonSuperclass:Form  
      View commonSuperclass:Image  
+     Integer commonSuperclass:Autoload      
     "
 
     "Modified: / 10.7.1998 / 02:13:04 / cg"
@@ -4384,5 +4387,5 @@
 !Behavior class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.213 2002-09-04 10:34:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.214 2002-09-12 09:13:07 cg Exp $'
 ! !