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.
This commit is contained in:
Campbell Barton 2018-02-22 17:09:25 +11:00
parent 026ac65831
commit 5b857102fa
1 changed files with 3 additions and 2 deletions

View File

@ -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: