Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Thu, 6 Dec 2018 00:27:57 +0000 (11:27 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 6 Dec 2018 00:27:57 +0000 (11:27 +1100)
1  2 
source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c

@@@ -692,15 -687,17 +692,17 @@@ static int paint_weight_gradient_modal(
  
        if (ret & OPERATOR_CANCELLED) {
                Object *ob = CTX_data_active_object(C);
-               Mesh *me = ob->data;
-               if (vert_cache->wpp.wpaint_prev) {
-                       BKE_defvert_array_free_elems(me->dvert, me->totvert);
-                       BKE_defvert_array_copy(me->dvert, vert_cache->wpp.wpaint_prev, me->totvert);
-                       wpaint_prev_destroy(&vert_cache->wpp);
+               if (vert_cache != NULL) {
+                       Mesh *me = ob->data;
+                       if (vert_cache->wpp.wpaint_prev) {
+                               BKE_defvert_array_free_elems(me->dvert, me->totvert);
+                               BKE_defvert_array_copy(me->dvert, vert_cache->wpp.wpaint_prev, me->totvert);
+                               wpaint_prev_destroy(&vert_cache->wpp);
+                       }
+                       MEM_freeN(vert_cache);
                }
-               MEM_freeN(vert_cache);
  
 -              DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 +              DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
                WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
        }
        else if (ret & OPERATOR_FINISHED) {