Fix #115007: Crash when creating transition from last reiming key

This operation is not permitted, cancel operator execution when
attempted.

Pull Request: https://projects.blender.org/blender/blender/pulls/115122
This commit is contained in:
Richard Antalik
2023-11-21 05:27:24 +01:00
committed by Richard Antalik
parent 8d2b203a3d
commit 918515495e
2 changed files with 8 additions and 0 deletions

View File

@@ -446,6 +446,11 @@ static bool transition_add_new_for_seq(const bContext *C,
key = SEQ_retiming_key_get_by_timeline_frame(scene, seq, timeline_frame);
}
if (SEQ_retiming_is_last_key(seq, key) || key->strip_frame_index == 0) {
BKE_report(op->reports, RPT_WARNING, "Can not create transition from first or last key");
return false;
}
SeqRetimingKey *transition = SEQ_retiming_add_transition(scene, seq, key, duration);
if (transition == nullptr) {

View File

@@ -526,6 +526,9 @@ SeqRetimingKey *SEQ_retiming_add_transition(const Scene *scene,
SeqRetimingKey *key,
const int offset)
{
BLI_assert(!SEQ_retiming_is_last_key(seq, key));
BLI_assert(key->strip_frame_index != 0);
SeqRetimingKey *prev_key = key - 1;
if ((key->flag & SEQ_SPEED_TRANSITION_IN) != 0 ||
(prev_key->flag & SEQ_SPEED_TRANSITION_IN) != 0) {