Fix T56720: Lattice: crash on setting points_u/v/w from python.
authorBastien Montagne <montagne29@wanadoo.fr>
Sat, 8 Sep 2018 13:29:39 +0000 (15:29 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Sat, 8 Sep 2018 13:29:39 +0000 (15:29 +0200)
One need to check that there is something to free, before trying to free it...

source/blender/blenkernel/intern/lattice.c

index 582743acff475f4d1ed853089bf5efe8524ea963..1e99712f47ab9377b809ca1a8ac68011c1268f13 100644 (file)
@@ -216,7 +216,9 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
                lt->typeu = lt->typev = lt->typew = KEY_LINEAR;
 
                /* prevent using deformed locations */
-               BKE_displist_free(&ltOb->curve_cache->disp);
+               if (ltOb->curve_cache != NULL) {
+                       BKE_displist_free(&ltOb->curve_cache->disp);
+               }
 
                copy_m4_m4(mat, ltOb->obmat);
                unit_m4(ltOb->obmat);