fix for py/rna mesh.materials[:] where empty materials exist, would raise a runtime...
[blender-staging.git] / source / blender / makesrna / intern / rna_pose.c
index 51a44c027e408414773c443eb5437bc3c3e20c74..7b1a46dd6e292c0c87d5e738ce496213284d4ef3 100644 (file)
@@ -547,13 +547,17 @@ static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index)
 }
 
 /* not essential, but much faster then the default lookup function */
-PointerRNA rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key)
+int rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
 {
-       PointerRNA rptr;
        bPose *pose= (bPose*)ptr->data;
        bPoseChannel *pchan= get_pose_channel(pose, key);
-       RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, &rptr);
-       return rptr;
+       if(pchan) {
+               RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, r_ptr);
+               return TRUE;
+       }
+       else {
+               return FALSE;
+       }
 }
 
 static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values)