diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-22 09:09:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-22 09:09:25 +0300 |
commit | 5b857102fa6d3e1f92530343448b142c9666e8d8 (patch) | |
tree | 2f72e2e3133083cedbd775e20d9491fd5e1115a5 /source | |
parent | 026ac65831f340c4517903d2b7a377a957b55c0a (diff) |
Add NULL checks to ED_object_base_activate
Passing a NULL active base is valid,
own changes to mode-switching didn't check for this case.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/object/object_select.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 8a62438dc80..851a5d86d1b 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -141,13 +141,14 @@ void ED_object_base_activate(bContext *C, Base *base) { Scene *scene = CTX_data_scene(C); + Object *obact = base ? base->object : NULL; /* We don't know the previous active object in update. * * Not correct because it's possible other work-spaces use these. * although that's a corner case. */ if (workspace->object_mode & OB_MODE_EDIT) { FOREACH_OBJECT(view_layer, ob) { - if (ob != base->object) { + if (ob != obact) { if (BKE_object_is_in_editmode(ob)) { ED_object_editmode_exit_ex(NULL, workspace, scene, ob, EM_FREEDATA); } @@ -159,7 +160,7 @@ void ED_object_base_activate(bContext *C, Base *base) EvaluationContext eval_ctx; CTX_data_eval_ctx(C, &eval_ctx); FOREACH_OBJECT(view_layer, ob) { - if (ob != base->object) { + if (ob != obact) { if (ob->sculpt) { switch (ob->sculpt->mode_type) { case OB_MODE_VERTEX_PAINT: |