Fix: Crash with no active object after recent commit

rBaa13c4b386b13111 added a check for the active object
in drawing code, but it missed adding a check for the active
base before trying to retrieve its object.
This commit is contained in:
Hans Goudey 2021-11-09 12:59:20 -06:00
parent 7c25399576
commit 44239fa106
1 changed files with 4 additions and 3 deletions

View File

@ -295,9 +295,10 @@ int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color
{
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool is_edit = (draw_ctx->object_mode & OB_MODE_EDIT) && (ob->mode & OB_MODE_EDIT);
const bool active = (ob->base_flag & BASE_FROM_DUPLI) ?
(DRW_object_get_dupli_parent(ob) == view_layer->basact->object) :
(view_layer->basact && view_layer->basact->object == ob);
const bool active = view_layer->basact &&
((ob->base_flag & BASE_FROM_DUPLI) ?
(DRW_object_get_dupli_parent(ob) == view_layer->basact->object) :
(view_layer->basact->object == ob));
/* confusing logic here, there are 2 methods of setting the color
* 'colortab[colindex]' and 'theme_id', colindex overrides theme_id.