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
This commit is contained in:
2019-07-25 17:06:53 -03:00
parent 1d7be99ba4
commit 11b994e26e

View File

@@ -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);