Fix crash when no active object

To reproduce the crash: delete the active object of the scene.

This bug was introduced on e9c40b7339.
This commit is contained in:
Dalai Felinto 2018-02-06 13:17:43 -02:00
parent 1ae5dfd049
commit 5633bab2d0
1 changed files with 4 additions and 3 deletions

View File

@ -528,11 +528,12 @@ void ED_info_stats_clear(ViewLayer *view_layer)
const char *ED_info_stats_string(Scene *scene, ViewLayer *view_layer)
{
Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL;
const eObjectMode object_mode = (view_layer->basact) ? view_layer->basact->object->mode : OB_MODE_OBJECT;
if (!view_layer->stats) {
stats_update(scene, view_layer, ob->mode);
stats_update(scene, view_layer, object_mode);
}
stats_string(scene, view_layer, ob->mode);
stats_string(scene, view_layer, object_mode);
return view_layer->stats->infostr;
}