fix [#35793] Crash When Painting Gradient Weight
authorCampbell Barton <ideasman42@gmail.com>
Wed, 19 Jun 2013 07:45:36 +0000 (07:45 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 19 Jun 2013 07:45:36 +0000 (07:45 +0000)
source/blender/editors/sculpt_paint/paint_vertex.c

index 1ff7df3b0419d2101148c52d41820f0b26f77631..181b32d58fc2e19ca3f808db04ee7b281ce4de35 100644 (file)
@@ -2145,7 +2145,7 @@ struct WPaintData {
 };
 
 /* ensure we have data on wpaint start, add if needed */
-static int wpaint_ensure_data(bContext *C, wmOperator *op)
+static bool wpaint_ensure_data(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
        Object *ob = CTX_data_active_object(C);
@@ -3390,6 +3390,10 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
                vert_cache = gesture->userdata;
        }
        else {
+               if (wpaint_ensure_data(C, op) == FALSE) {
+                       return OPERATOR_CANCELLED;
+               }
+
                data.is_init = true;
                vert_cache = MEM_mallocN(sizeof(DMGradient_vertStore) * me->totvert, __func__);
        }