summaryrefslogtreecommitdiff
path: root/Objective-C
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-03 23:21:48 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-03 23:21:48 +0100
commit94383388101170742989e188e020f91b81a2ddfe (patch)
tree4b2ecbbcf6cdb7172e8cbc2cb6b2f676fc23706a /Objective-C
parent046f4e6ecbe2cbef2079eb8a245895ff70238e92 (diff)
Glue layer: Add slot handling functions.
darcs-hash:27035c01db5e23dc0c8c9786ded92aa6e564e6d4
Diffstat (limited to 'Objective-C')
-rw-r--r--Objective-C/libobjcl.m13
1 files changed, 9 insertions, 4 deletions
diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m
index f49d502..7c1c186 100644
--- a/Objective-C/libobjcl.m
+++ b/Objective-C/libobjcl.m
@@ -406,10 +406,15 @@ objcl_class_direct_slots (Class class, unsigned int *count, unsigned int *elemen
#ifdef __NEXT_RUNTIME__
ivars = class_copyIvarList (class, count);
#else
- *count = class->ivars->ivar_count;
- ivars = malloc ((*count) * (*element_size));
- for (i = 0; i < *count; i++)
- ivars[i] = &class->ivars->ivar_list[i];
+ *count = (class->ivars ? class->ivars->ivar_count : 0);
+ if (!*count)
+ ivars = NULL;
+ else
+ {
+ ivars = malloc ((*count) * (*element_size));
+ for (i = 0; i < *count; i++)
+ ivars[i] = &class->ivars->ivar_list[i];
+ }
#endif
return ivars;