[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40140] trunk/blender/source/blender/ editors/animation/keyframing.c: fix for passing NULL to strstr() in visualkey_can_use()
Campbell Barton
ideasman42 at gmail.com
Mon Sep 12 02:13:51 CEST 2011
Revision: 40140
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40140
Author: campbellbarton
Date: 2011-09-12 00:13:49 +0000 (Mon, 12 Sep 2011)
Log Message:
-----------
fix for passing NULL to strstr() in visualkey_can_use()
Modified Paths:
--------------
trunk/blender/source/blender/editors/animation/keyframing.c
Modified: trunk/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframing.c 2011-09-12 00:00:21 UTC (rev 40139)
+++ trunk/blender/source/blender/editors/animation/keyframing.c 2011-09-12 00:13:49 UTC (rev 40140)
@@ -531,7 +531,7 @@
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 @@
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 @@
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 @@
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;
}
More information about the Bf-blender-cvs
mailing list