Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-04-07 20:48:11 +0300
committerMike Erwin <significant.bit@gmail.com>2017-04-07 20:48:11 +0300
commit23b10b549a1b7e713abd97dea32483d40d9bb18f (patch)
tree54e0d3d1507e8f00ba9a7bfd8b0c39796895a589 /source
parent3f6d25f4ebcccaafeb74e3d2c8aa505d0f8f5a7e (diff)
fix use of uninitialized variable
Bug crawled in via 2944438e9a276e48d7eabb5bb88ecec9b2f1e7dc as part of custom manipulators.
Diffstat (limited to 'source')
-rw-r--r--source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c b/source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c
index 7d33a82568f..9755d090e8b 100644
--- a/source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/manipulator_library/primitive_manipulator.c
@@ -84,18 +84,20 @@ static void manipulator_primitive_draw_geom(
const float col_inner[4], const float col_outer[4], const int style)
{
float (*verts)[3];
- float vert_count;
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int vert_count = 0;
if (style == MANIPULATOR_PRIMITIVE_STYLE_PLANE) {
verts = verts_plane;
vert_count = ARRAY_SIZE(verts_plane);
}
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- wm_manipulator_vec_draw(col_inner, verts, vert_count, pos, PRIM_TRIANGLE_FAN);
- wm_manipulator_vec_draw(col_outer, verts, vert_count, pos, PRIM_LINE_LOOP);
- immUnbindProgram();
+ if (vert_count > 0) {
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
+ wm_manipulator_vec_draw(col_inner, verts, vert_count, pos, PRIM_TRIANGLE_FAN);
+ wm_manipulator_vec_draw(col_outer, verts, vert_count, pos, PRIM_LINE_LOOP);
+ immUnbindProgram();
+ }
}
static void manipulator_primitive_draw_intern(