diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-08-29 10:56:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-08-29 10:56:19 +0400 |
commit | 1d9e69f1463f01ab2242b05cb6a0486a6f9eaeaf (patch) | |
tree | f9ca95c68436ac36ceda4f9ece0b345366d5bfc2 /source/blender/editors | |
parent | 55cacb2e63e342705e25e205c1b805956a7226bd (diff) |
Fix T41617: Color ramp crashes user preferences
Color ramps with no handles caused issues.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 8 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 15b8494cb34..235d7652539 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1151,9 +1151,11 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti } /* layer: active handle */ - cbd = &coba->data[coba->cur]; - pos = x1 + cbd->pos * (sizex - 1) + 1; - ui_draw_colorband_handle(rect, pos, &cbd->r, display, true); + if (coba->tot != 0) { + cbd = &coba->data[coba->cur]; + pos = x1 + cbd->pos * (sizex - 1) + 1; + ui_draw_colorband_handle(rect, pos, &cbd->r, display, true); + } } void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, const rcti *rect) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 166090c95ca..2d919a2afc1 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5020,6 +5020,9 @@ static bool ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int m if (data->draglastx == mx) return changed; + if (data->coba->tot == 0) + return changed; + dx = ((float)(mx - data->draglastx)) / BLI_rctf_size_x(&but->rect); data->dragcbd->pos += dx; CLAMP(data->dragcbd->pos, 0.0f, 1.0f); |