diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-15 07:56:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-15 07:56:01 +0400 |
commit | 0093ea2a79648c56a30fe65494134a09f91054b7 (patch) | |
tree | adc08548d4dac13851d47c2e3bc7f0af0c9edc03 | |
parent | c483a54207d78acea785566e82f54145457466ec (diff) |
safety NULL check for r51327, don't assume ED_object_modifier_add() succeeds.
-rw-r--r-- | source/blender/editors/object/object_relations.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b7efe9189d8..447ba29e203 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -679,21 +679,27 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object switch (partype) { case PAR_CURVE: /* curve deform */ - if (modifiers_isDeformedByCurve(ob) != par) { + if ( modifiers_isDeformedByCurve(ob) != par) { md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve); - ((CurveModifierData *)md)->object = par; + if (md) { + ((CurveModifierData *)md)->object = par; + } } break; case PAR_LATTICE: /* lattice deform */ if (modifiers_isDeformedByLattice(ob) != par) { md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Lattice); - ((LatticeModifierData *)md)->object = par; + if (md) { + ((LatticeModifierData *)md)->object = par; + } } break; default: /* armature deform */ if (modifiers_isDeformedByArmature(ob) != par) { md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature); - ((ArmatureModifierData *)md)->object = par; + if (md) { + ((ArmatureModifierData *)md)->object = par; + } } break; } |