From 56460a0340b6afdb26fa19eb5bd92eda1a1693aa Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 12 Sep 2011 00:13:49 +0000 Subject: fix for passing NULL to strstr() in visualkey_can_use() --- source/blender/editors/animation/keyframing.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 53c9fc4d82c..1e7c18dc6ac 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -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; } -- cgit v1.2.3