Commit abfb53a8 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Be more careful about NULLs here

parent 75d7aaff
...@@ -563,9 +563,13 @@ static Box* _handleClsAttr(Box* obj, Box* attr) { ...@@ -563,9 +563,13 @@ static Box* _handleClsAttr(Box* obj, Box* attr) {
if (attr->cls == member_cls) { if (attr->cls == member_cls) {
BoxedMemberDescriptor* member_desc = static_cast<BoxedMemberDescriptor*>(attr); BoxedMemberDescriptor* member_desc = static_cast<BoxedMemberDescriptor*>(attr);
switch (member_desc->type) { switch (member_desc->type) {
case BoxedMemberDescriptor::OBJECT: case BoxedMemberDescriptor::OBJECT: {
assert(member_desc->offset % sizeof(Box*) == 0); assert(member_desc->offset % sizeof(Box*) == 0);
return reinterpret_cast<Box**>(obj)[member_desc->offset / sizeof(Box*)]; Box* rtn = reinterpret_cast<Box**>(obj)[member_desc->offset / sizeof(Box*)];
// be careful about returning NULLs; I'm not sure what the correct behavior is here:
RELEASE_ASSERT(rtn, "");
return rtn;
}
default: default:
RELEASE_ASSERT(0, "%d", member_desc->type); RELEASE_ASSERT(0, "%d", member_desc->type);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment