[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30314] trunk/blender/source/blender/ editors/animation/keyframing.c: Bugfix #22792: Blender crashes after inserting keyframe pressing "I" key

Joshua Leung aligorith at gmail.com
Wed Jul 14 13:03:07 CEST 2010


Revision: 30314
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30314
Author:   aligorith
Date:     2010-07-14 13:03:07 +0200 (Wed, 14 Jul 2010)

Log Message:
-----------
Bugfix #22792: Blender crashes after inserting keyframe pressing "I" key

Insert Keyframe function was not checking that an ID-block was given before trying to resolve the RNA-path using it. 

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	2010-07-14 10:55:37 UTC (rev 30313)
+++ trunk/blender/source/blender/editors/animation/keyframing.c	2010-07-14 11:03:07 UTC (rev 30314)
@@ -817,15 +817,21 @@
 short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag)
 {	
 	PointerRNA id_ptr, ptr;
-	PropertyRNA *prop;
+	PropertyRNA *prop = NULL;
 	FCurve *fcu;
 	int array_index_max= array_index+1;
 	int ret= 0;
 	
 	/* validate pointer first - exit if failure */
+	if (id == NULL) {
+		printf("Insert Key: no ID-block to insert keyframe in (Path = %s) \n", rna_path);
+		return 0;
+	}
+	
 	RNA_id_pointer_create(id, &id_ptr);
 	if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
-		printf("Insert Key: Could not insert keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)\n", id->name, rna_path);
+		printf("Insert Key: Could not insert keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)\n", 
+			(id)? id->name : "<Missing ID-Block>", rna_path);
 		return 0;
 	}
 	
@@ -922,7 +928,7 @@
 	if ELEM(NULL, id, adt) {
 		printf("ERROR: no ID-block and/or AnimData to delete keyframe from \n");
 		return 0;
-	}	
+	}
 	
 	/* validate pointer first - exit if failure */
 	RNA_id_pointer_create(id, &id_ptr);





More information about the Bf-blender-cvs mailing list