Add better asserts to track invalid object in scripting system crash bug
parent
f4ef3e6658
commit
bc6dbb2df9
|
@ -70,17 +70,9 @@ BOOL scrBaseObjGet(UDWORD index)
|
|||
}
|
||||
|
||||
// Check this is a valid pointer
|
||||
if (psObj == NULL )
|
||||
{
|
||||
debug(LOG_ERROR, "scrBaseObjGet: was passed an invalid pointer");
|
||||
return false;
|
||||
}
|
||||
// Check this is a valid pointer
|
||||
if (psObj->type != OBJ_DROID && psObj->type != OBJ_STRUCTURE && psObj->type != OBJ_FEATURE)
|
||||
{
|
||||
debug(LOG_ERROR, "scrBaseObjGet: invalid object");
|
||||
return false;
|
||||
}
|
||||
ASSERT_OR_RETURN(false, psObj, "Passed a NULL pointer to a base object");
|
||||
ASSERT_OR_RETURN(false, psObj->type == OBJ_DROID || psObj->type == OBJ_STRUCTURE || psObj->type == OBJ_FEATURE,
|
||||
"Invalid object %p of type %d", psObj, psObj->type);
|
||||
|
||||
// set the type and return value
|
||||
switch (index)
|
||||
|
|
Loading…
Reference in New Issue