Fix T73706: Crash after disabling dyntopo with multires modifier
authorPablo Dobarro <pablodp606@gmail.com>
Mon, 10 Feb 2020 17:41:03 +0000 (18:41 +0100)
committerPablo Dobarro <pablodp606@gmail.com>
Tue, 11 Feb 2020 15:38:46 +0000 (16:38 +0100)
ss->multires is set in sculpt_update_object, which is not called just
after disabling dyntopo, so it needs to be checked before running
reshapeFromCCG

Reviewed By: campbellbarton, brecht

Maniphest Tasks: T73706

Differential Revision: https://developer.blender.org/D6801

source/blender/blenkernel/intern/multires.c

index 23fa8dd60d5f97f3658de2f9e6521321355c274d..96608a931ab8f77f56e87dd0c0b6169c01ad2819 100644 (file)
@@ -410,7 +410,7 @@ void multires_flush_sculpt_updates(Object *ob)
 {
   if (ob && ob->sculpt && ob->sculpt->pbvh != NULL) {
     SculptSession *sculpt_session = ob->sculpt;
-    if (BKE_pbvh_type(sculpt_session->pbvh) == PBVH_GRIDS) {
+    if (BKE_pbvh_type(sculpt_session->pbvh) == PBVH_GRIDS && sculpt_session->multires) {
       Mesh *mesh = ob->data;
       multiresModifier_reshapeFromCCG(
           sculpt_session->multires->totlvl, mesh, sculpt_session->subdiv_ccg);