diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-16 19:32:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-16 19:32:25 +0300 |
commit | 2036a2638e3abf0d4cd3e494ede0babf0b8febbf (patch) | |
tree | e7205c5648a344af9928b7542c62a576e35978d7 /source/blender/editors | |
parent | bc9b873f60d414a5247063e0ad6ad0a9325d3d2f (diff) |
[#21182] Make proxy for object without group crash Blender.
from Banlu Kemiyatorn (suchness), modified with more error messages.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b9713ca15c2..46cf914755d 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -302,12 +302,23 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt) static int make_proxy_exec (bContext *C, wmOperator *op) { - Object *ob, *gob= CTX_data_active_object(C); - GroupObject *go= BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "type")); + Object *ob, *gob; + GroupObject *go; Scene *scene= CTX_data_scene(C); - ob= go->ob; - if (ob) { + if(!(gob=CTX_data_active_object(C))) { + BKE_report(op->reports, RPT_ERROR, "No active object"); + return OPERATOR_CANCELLED; + } else if(gob->dup_group==NULL) { + BKE_report(op->reports, RPT_ERROR, "Active obhect has no dupligroup"); + return OPERATOR_CANCELLED; + } else if(!(go= BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "type")))) { + BKE_report(op->reports, RPT_ERROR, "Active objects dupligroup could not be found"); + return OPERATOR_CANCELLED; + } else if (!(ob= go->ob)) { + BKE_report(op->reports, RPT_ERROR, "Group has no object to make the proxy with"); + return OPERATOR_CANCELLED; + } else { Object *newob; Base *newbase, *oldbase= BASACT; char name[32]; @@ -339,10 +350,6 @@ static int make_proxy_exec (bContext *C, wmOperator *op) DAG_id_flush_update(&newob->id, OB_RECALC); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, newob); } - else { - BKE_report(op->reports, RPT_ERROR, "No object to make proxy for"); - return OPERATOR_CANCELLED; - } return OPERATOR_FINISHED; } |