Add better asserts to track invalid object in scripting system crash bug

master
Per Inge Mathisen 2011-01-17 22:23:03 +01:00
parent f4ef3e6658
commit bc6dbb2df9
1 changed files with 3 additions and 11 deletions

View File

@ -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)