[Bf-blender-cvs] [d92f6b9] master: T38763 Fix: avoid NPE When no custom properties are defined

gaiaclary noreply at git.blender.org
Sun Feb 23 15:33:30 CET 2014


Commit: d92f6b9903c8b914523ef7b3aa228a11f34bd605
Author: gaiaclary
Date:   Sun Feb 23 15:32:49 2014 +0100
https://developer.blender.org/rBd92f6b9903c8b914523ef7b3aa228a11f34bd605

T38763 Fix: avoid NPE When no custom properties are defined

===================================================================

M	source/blender/collada/ControllerExporter.cpp

===================================================================

diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 6a17afc..c544382 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -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;
 }




More information about the Bf-blender-cvs mailing list