mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-16 17:01:53 +00:00
[qfcc] Ensure type src type is a class
If the src type is not a class, there is no inheritance chain to walk. Fixes a segfault when returning self after a syntax error in the following: +(EditStatus *)withRect:(Rect)rect { return [[[self alloc] initWithRect:rect]: } -setCursorMode:(CursorMode)mode { cursorMode = mode; return self; }
This commit is contained in:
parent
2a38135dd9
commit
927a446bd3
1 changed files with 4 additions and 2 deletions
|
@ -455,7 +455,7 @@ category_implements (category_t *cat, protocol_t *protocol)
|
|||
int
|
||||
obj_types_assignable (const type_t *dst, const type_t *src)
|
||||
{
|
||||
class_t *dst_class, *src_class;
|
||||
class_t *dst_class, *src_class = 0;
|
||||
category_t *cat;
|
||||
int dst_is_proto, src_is_proto;
|
||||
protocollist_t *dst_protos = 0, *src_protos = 0;
|
||||
|
@ -507,7 +507,9 @@ obj_types_assignable (const type_t *dst, const type_t *src)
|
|||
|
||||
// check dst is a base class of src
|
||||
dst_class = dst->t.fldptr.type->t.class;
|
||||
src_class = src->t.fldptr.type->t.class;
|
||||
if (src->t.fldptr.type->meta == ty_class) {
|
||||
src_class = src->t.fldptr.type->t.class;
|
||||
}
|
||||
//printf ("%s %s\n", dst_class->name, src_class->name);
|
||||
while (dst_class != src_class && src_class) {
|
||||
src_class = src_class->super_class;
|
||||
|
|
Loading…
Reference in a new issue