Fix #23431: crash in brush icon preview when there is no active object.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 22 Aug 2010 10:17:31 +0000 (10:17 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 22 Aug 2010 10:17:31 +0000 (10:17 +0000)
source/blender/editors/interface/interface_icons.c

index 3ba7c65..499c676 100644 (file)
@@ -1027,11 +1027,11 @@ static int ui_id_brush_get_icon(bContext *C, ID *id, int preview)
                EnumPropertyItem *items;
                int tool;
                
-               if(ob->mode & OB_MODE_SCULPT) {
+               if(ob && (ob->mode & OB_MODE_SCULPT)) {
                        items = brush_sculpt_tool_items;
                        tool = br->sculpt_tool;
                }
-               else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT)) {
+               else if(ob && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))) {
                        items = brush_vertexpaint_tool_items;
                        tool = br->vertexpaint_tool;
                }