Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-09-27 02:09:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-27 02:09:56 +0400
commitb6ac10f42a50143b9cd3fa2047d2cde7f1d9a8ce (patch)
tree4b13d0a5b02194c0c59e794b9404261747afec9f /source/blender/editors/sculpt_paint/sculpt_undo.c
parent8a51d235e608dc45c30338aaaa74f925c185c73a (diff)
minor change for sculpt undo, was getting the derived-mesh before calling sculpt_update_mesh_elements().
also add NULL check for BKE_key_from_object(), to avoid unlikely but possible NULL pointer dereference.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_undo.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index bb2b4b8c743..25555f2526f 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -108,7 +108,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
/* shape key has been changed before calling undo operator */
Key *key = BKE_key_from_object(ob);
- KeyBlock *kb = BKE_keyblock_find_name(key, unode->shapeName);
+ KeyBlock *kb = key ? BKE_keyblock_find_name(key, unode->shapeName) : NULL;
if (kb) {
ob->shapenr = BLI_findindex(&key->block, kb) + 1;
@@ -266,13 +266,15 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
Scene *scene = CTX_data_scene(C);
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
Object *ob = CTX_data_active_object(C);
- DerivedMesh *dm = mesh_get_derived_final(scene, ob, 0);
+ DerivedMesh *dm;
SculptSession *ss = ob->sculpt;
SculptUndoNode *unode;
MultiresModifierData *mmd;
int update = FALSE, rebuild = FALSE;
sculpt_update_mesh_elements(scene, sd, ob, 0);
+ /* call _after_ sculpt_update_mesh_elements() which may update 'ob->derivedFinal' */
+ dm = mesh_get_derived_final(scene, ob, 0);
for (unode = lb->first; unode; unode = unode->next) {
if (!(strcmp(unode->idname, ob->id.name) == 0))