diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-01 23:29:59 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-01 23:29:59 +0000 |
commit | c34d298cb3d741391b5c810c8999b7e0d11fa141 (patch) | |
tree | 13d311306a2e450cead72959b52908f3a1874875 /libobjc/Protocol.m | |
parent | 1a821ba124bfc62da58f60895bfe098e8bc6262f (diff) | |
download | gcc-c34d298cb3d741391b5c810c8999b7e0d11fa141.tar.gz |
PR 11433
gcc/testsuite:
* objc.dg/proto-lossage-3.m: New test.
libobjc:
* Protocol.m (descriptionForInstanceMethod): Don't dereference
instance_methods if it's NULL.
(descriptionForClassMethod): Likewise for class_methods.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74137 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc/Protocol.m')
-rw-r--r-- | libobjc/Protocol.m | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/libobjc/Protocol.m b/libobjc/Protocol.m index 8191dc21535..06a25acabbe 100644 --- a/libobjc/Protocol.m +++ b/libobjc/Protocol.m @@ -80,11 +80,12 @@ struct objc_method_description_list { const char* name = sel_get_name (aSel); struct objc_method_description *result; - for (i = 0; i < instance_methods->count; i++) - { - if (!strcmp ((char*)instance_methods->list[i].name, name)) - return &(instance_methods->list[i]); - } + if (instance_methods) + for (i = 0; i < instance_methods->count; i++) + { + if (!strcmp ((char*)instance_methods->list[i].name, name)) + return &(instance_methods->list[i]); + } for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) { @@ -107,11 +108,12 @@ struct objc_method_description_list { const char* name = sel_get_name (aSel); struct objc_method_description *result; - for (i = 0; i < class_methods->count; i++) - { - if (!strcmp ((char*)class_methods->list[i].name, name)) - return &(class_methods->list[i]); - } + if (class_methods) + for (i = 0; i < class_methods->count; i++) + { + if (!strcmp ((char*)class_methods->list[i].name, name)) + return &(class_methods->list[i]); + } for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) { |