Fix T58310: Crash when removing multires modifier from sculpt object
[blender.git] / source / blender / blenkernel / intern / multires_reshape.c
index 72be26177983d120436fd6e0d20aa3f8faf3df22..af3219ca06c45606d21a3988332f9f581e685112 100644 (file)
@@ -1163,6 +1163,11 @@ bool multiresModifier_reshapeFromCCG(
                return false;
        }
        MDisps *mdisps = CustomData_get_layer(&coarse_mesh->ldata, CD_MDISPS);
+       if (mdisps == NULL) {
+               /* Multires displacement has been removed before current changes were
+                * applies to all the levels. */
+               return false;
+       }
        GridPaintMask *grid_paint_mask =
                CustomData_get_layer(&coarse_mesh->ldata, CD_GRID_PAINT_MASK);
        Subdiv *subdiv = subdiv_ccg->subdiv;