T38763 Fix: avoid NPE When no custom properties are defined

This commit is contained in:
Gaia Clary 2014-02-23 15:32:49 +01:00
parent cb1b6b549e
commit d92f6b9903
Notes: blender-bot 2023-02-14 11:08:37 +01:00
Referenced by issue #38763, Crash on OS X when exporting rigged mesh with option "Export for OpenSim" checked
1 changed files with 17 additions and 18 deletions

View 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;
}