diff --git a/Source/ASTextNode.mm b/Source/ASTextNode.mm index e98dfb261..5452f96fd 100644 --- a/Source/ASTextNode.mm +++ b/Source/ASTextNode.mm @@ -1324,8 +1324,9 @@ + (id)allocWithZone:(struct _NSZone *)zone // We are descended from ASTextNode. We need to change the superclass for the // ASTextNode subclass to ASTextNode2. // Walk up the class hierarchy until we find ASTextNode. + // Note: This may be called on multiple threads simultaneously. Class s; - for (Class c = self; c != [ASTextNode class]; c = s) { + for (Class c = self; c != Nil && c != [ASTextNode class]; c = s) { s = class_getSuperclass(c); if (s == [ASTextNode class]) { #pragma clang diagnostic push