diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-07 07:10:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-07 07:10:37 +0300 |
commit | adf961a46cea7d3d7d6a3caf05a74f560201aa2e (patch) | |
tree | 0dedf06ed051c7ea9ceb6cb074f1bb4babae5826 /source/blender/editors/interface | |
parent | e14247d0797bc202f6be6d25615a47a415c2b45d (diff) |
fix [#25520] crash when closing the properties panel in uv/image editor
don't draw the image if the size is 0.
Crash was actually an assert() so debug builds only, replace assert() with BKE_assert() so crash is opt in build option.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 14 |
2 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index b0ab90279f8..f8aa335b929 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -28,7 +28,6 @@ #include <math.h> #include <stdlib.h> #include <string.h> -#include <assert.h> #ifndef WIN32 #include <unistd.h> @@ -851,7 +850,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), /* sanity check */ if(w<=0 || h<=0 || w>2000 || h>2000) { printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h); - assert(!"invalid icon size"); + BKE_assert(!"invalid icon size"); return; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index efdb2ef5f5e..1ce045ced74 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -747,7 +747,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha), rcti *rect) { - int w, h, x, y, size; + int w, h, size; if(icon==ICON_NULL) return; @@ -756,11 +756,13 @@ static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha h = rect->ymax - rect->ymin; size = MIN2(w, h); size -= PREVIEW_PAD*2; /* padding */ - - x = rect->xmin + w/2 - size/2; - y = rect->ymin + h/2 - size/2; - - UI_icon_draw_preview_aspect_size(x, y, icon, aspect, size); + + if(size > 0) { + int x = rect->xmin + w/2 - size/2; + int y = rect->ymin + h/2 - size/2; + + UI_icon_draw_preview_aspect_size(x, y, icon, aspect, size); + } } |