diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-29 17:48:08 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-29 17:49:09 +0300 |
commit | 4c2a3b47014c086ad2856524ee3d542d5ba1d245 (patch) | |
tree | 50e5984b728cbbcb9e9ea8d8c7b73a97c82fa3c1 /source/blender | |
parent | 3cc0eb36c3c05ac2661e2fac04c51db1bf0082b9 (diff) |
Fix T57878: 2.8 Opening project in Blender Crashes.
Crash was due to some modifier trying to access the editmesh of its
target just after loading, when that editmesh has not yet been
re-created...
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 73a9d462687..d67a3080819 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -907,20 +907,22 @@ struct DerivedMesh *modifier_applyModifier_DM_deprecated( /** * Get evaluated mesh for other evaluated object, which is used as an operand for the modifier, * e.g. second operand for boolean modifier. - * Note thqt modifiers in stack always get fully evaluated COW ID pointers, never original ones. Makes things simpler. + * Note that modifiers in stack always get fully evaluated COW ID pointers, never original ones. Makes things simpler. */ Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval, bool *r_free_mesh) { - Mesh *me; + Mesh *me = NULL; if ((ob_eval->type == OB_MESH) && (ob_eval->mode & OB_MODE_EDIT)) { /* Note: currently we have no equivalent to derived cagemesh or even final dm in BMEditMesh... * This is TODO in core depsgraph/modifier stack code still. */ BMEditMesh *em = BKE_editmesh_from_object(ob_eval); - me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, 0); - *r_free_mesh = true; + if (em != NULL) { /* em might not exist yet in some cases, just after loading a .blend file, see T57878. */ + me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, 0); + *r_free_mesh = true; + } } - else { + if (me == NULL) { me = ob_eval->runtime.mesh_eval; *r_free_mesh = false; } |