From ff7af18060310d2e44232e3fc383dfa25ea1554c Mon Sep 17 00:00:00 2001 From: theraven Date: Sat, 13 Mar 2010 13:01:53 +0000 Subject: [PATCH] Correctly handle getting the name of nil. For some given value of correct, where 'correct' means 'compatible with the Apple behaviour' and not 'actually sensible'. --- runtime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime.c b/runtime.c index 171850f..1b2e34c 100644 --- a/runtime.c +++ b/runtime.c @@ -424,6 +424,7 @@ IMP class_getMethodImplementation_stret(Class cls, SEL name) const char * class_getName(Class cls) { + if (Nil == cls) { return "nil"; } return cls->name; } @@ -827,6 +828,7 @@ Class object_setClass(id obj, Class cls) const char *object_getClassName(id obj) { + if (nil == obj) { return "nil"; } return class_getName(object_getClass(obj)); }