diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-07-25 23:06:53 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-07-26 14:29:38 +0300 |
commit | 11b994e26e4dbfc40dc6ff2194b7855e2eb20f23 (patch) | |
tree | 23c841d14bc6c6d3fcecadfd8becce84b8f9ce47 /source/blender/editors/interface/interface_draw.c | |
parent | 1d7be99ba4886dcf95a72a8597098e109dc10f95 (diff) |
Fix T67671: Blender crashes when resizing sidebar with a colorbamp
The amount of triangles drawn by the button depends on its `sizex`.
See:
```
immBegin(GPU_PRIM_TRI_STRIP, (sizex + 1) * 2);
```
Therefore the `sizex` cannot be 0.
Solution a bit similar to rB56b0cd1d.
Ref T67671
Reviewers: fclem, brecht
Maniphest Tasks: T67671
Differential Revision: https://developer.blender.org/D5347
Diffstat (limited to 'source/blender/editors/interface/interface_draw.c')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 7afdbe9d266..6a36bf364a3 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1606,6 +1606,11 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const float sizey_solid = sizey * 0.25f; float y1 = rect->ymin; + /* exit early if too narrow */ + if (sizex <= 0) { + return; + } + GPUVertFormat *format = immVertexFormat(); pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); |