fix for passing NULL to strstr() in visualkey_can_use()
This commit is contained in:
@@ -531,7 +531,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
|
||||
bConstraint *con= NULL;
|
||||
short searchtype= VISUALKEY_NONE;
|
||||
short has_parent = FALSE;
|
||||
char *identifier= NULL;
|
||||
const char *identifier= NULL;
|
||||
|
||||
/* validate data */
|
||||
// TODO: this check is probably not needed, but it won't hurt
|
||||
@@ -548,7 +548,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
|
||||
Object *ob= (Object *)ptr->data;
|
||||
|
||||
con= ob->constraints.first;
|
||||
identifier= (char *)RNA_property_identifier(prop);
|
||||
identifier= RNA_property_identifier(prop);
|
||||
has_parent= (ob->parent != NULL);
|
||||
}
|
||||
else if (ptr->type == &RNA_PoseBone) {
|
||||
@@ -556,7 +556,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
|
||||
bPoseChannel *pchan= (bPoseChannel *)ptr->data;
|
||||
|
||||
con= pchan->constraints.first;
|
||||
identifier= (char *)RNA_property_identifier(prop);
|
||||
identifier= RNA_property_identifier(prop);
|
||||
has_parent= (pchan->parent != NULL);
|
||||
}
|
||||
|
||||
@@ -565,12 +565,18 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
|
||||
return 0;
|
||||
|
||||
/* location or rotation identifiers only... */
|
||||
if (strstr(identifier, "location"))
|
||||
if(identifier == NULL) {
|
||||
printf("%s failed: NULL identifier\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
else if (strstr(identifier, "location")) {
|
||||
searchtype= VISUALKEY_LOC;
|
||||
else if (strstr(identifier, "rotation"))
|
||||
}
|
||||
else if (strstr(identifier, "rotation")) {
|
||||
searchtype= VISUALKEY_ROT;
|
||||
}
|
||||
else {
|
||||
printf("visualkey_can_use() failed: identifier - '%s' \n", identifier);
|
||||
printf("%s failed: identifier - '%s' \n", __func__, identifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user