T38763 Fix: avoid NPE When no custom properties are defined
authorgaiaclary <gaia.clary@machinimatrix.org>
Sun, 23 Feb 2014 14:32:49 +0000 (15:32 +0100)
committergaiaclary <gaia.clary@machinimatrix.org>
Sun, 23 Feb 2014 14:33:10 +0000 (15:33 +0100)
source/blender/collada/ControllerExporter.cpp

index 6a17afca6bd0f7bc69648aa577745586c58073e5..c5443828f60d6edb01bb0f1a1de8466cf77a5e00 100644 (file)
@@ -469,26 +469,25 @@ std::string ControllerExporter::add_joints_source(Object *ob_arm, ListBase *defb
 
 static float get_property(Bone *bone, const char *key, float def)
 {
-       float result;
-       IDProperty *property = IDP_GetPropertyFromGroup(bone->prop, key);
-       if (property) {
-               switch(property->type) {
-                       case IDP_INT:
-                               result = (float)(IDP_Int(property));
-                               break;
-                       case IDP_FLOAT:
-                               result = (float)(IDP_Float(property));
-                               break;
-                       case IDP_DOUBLE:
-                               result = (float)(IDP_Double(property));
-                               break;
-                       default:
-                               result = def;
+       float result = def;
+       if (bone->prop) {
+               IDProperty *property = IDP_GetPropertyFromGroup(bone->prop, key);
+               if (property) {
+                       switch(property->type) {
+                               case IDP_INT:
+                                       result = (float)(IDP_Int(property));
+                                       break;
+                               case IDP_FLOAT:
+                                       result = (float)(IDP_Float(property));
+                                       break;
+                               case IDP_DOUBLE:
+                                       result = (float)(IDP_Double(property));
+                                       break;
+                               default:
+                                       result = def;
+                       }
                }
        }
-       else {
-               result = def;
-       }
        return result;
 }