Fix T48830: Outliner draw crash, missing NULL check

Fix from @cheleb
This commit is contained in:
Campbell Barton 2016-07-12 14:39:39 +10:00
parent 0708b9aba8
commit b8f217ef21

@ -1240,7 +1240,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
UI_icon_draw(x, y, ICON_DOT); break; UI_icon_draw(x, y, ICON_DOT); break;
} }
} }
else if (GS(tselem->id->name) == ID_OB) { else if (tselem->id) {
if (GS(tselem->id->name) == ID_OB) {
Object *ob = (Object *)tselem->id; Object *ob = (Object *)tselem->id;
switch (ob->type) { switch (ob->type) {
case OB_LAMP: case OB_LAMP:
@ -1265,7 +1266,6 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SPEAKER); break; tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SPEAKER); break;
case OB_EMPTY: case OB_EMPTY:
tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_EMPTY); break; tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_EMPTY); break;
} }
} }
else { else {
@ -1283,7 +1283,6 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
case ID_LA: case ID_LA:
{ {
Lamp *la = (Lamp *)tselem->id; Lamp *la = (Lamp *)tselem->id;
switch (la->type) { switch (la->type) {
case LA_LOCAL: case LA_LOCAL:
tselem_draw_icon_uibut(&arg, ICON_LAMP_POINT); break; tselem_draw_icon_uibut(&arg, ICON_LAMP_POINT); break;
@ -1342,6 +1341,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
tselem_draw_icon_uibut(&arg, ICON_GREASEPENCIL); break; tselem_draw_icon_uibut(&arg, ICON_GREASEPENCIL); break;
} }
} }
}
} }
static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, SpaceOops *soops, ListBase *lb, int level, static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, SpaceOops *soops, ListBase *lb, int level,