diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 8e143e2303b..9a04312aaab 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1564,6 +1564,12 @@ bool BKE_nla_action_stash(AnimData *adt) NlaTrack *nlt; NlaStrip *strip; + /* sanity check */ + if (ELEM(NULL, adt, adt->action)) { + printf("%s: Invalid argument - %p %p\n", __func__, adt, adt->action); + return false; + } + /* do not add if it is already stashed */ if (BKE_nla_action_is_stashed(adt, adt->action)) return false; @@ -1576,6 +1582,7 @@ bool BKE_nla_action_stash(AnimData *adt) } nlt = add_nlatrack(adt, prev_track); + BLI_assert(nlt != NULL); BLI_strncpy(nlt->name, STASH_TRACK_NAME, sizeof(nlt->name)); BLI_uniquename(&adt->nla_tracks, nlt, STASH_TRACK_NAME, '.', offsetof(NlaTrack, name), sizeof(nlt->name)); @@ -1584,6 +1591,7 @@ bool BKE_nla_action_stash(AnimData *adt) * NOTE: a new user is created here */ strip = add_nlastrip(adt->action); + BLI_assert(strip != NULL); BKE_nlatrack_add_strip(nlt, strip); BKE_nlastrip_validate_name(adt, strip); diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 149956106c5..764e426341a 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -217,8 +217,8 @@ static int action_new_exec(bContext *C, wmOperator *UNUSED(op)) adt = actedit_animdata_from_context(C); } - /* Perform stashing operation */ - if (adt) { + /* Perform stashing operation - But only if there is an action */ + if (adt && oldact) { /* stash the action */ if (BKE_nla_action_stash(adt)) { /* The stash operation will remove the user already