From e4289f23604a4dfa1b3ba45b9e5eaf7bf47f420c Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Mon, 4 Apr 2022 16:27:37 +0200 Subject: Fix errors in sequencer channel headers Failing constraint test uncovered crashes on NULL dereference and missing channels initialization in `SEQ_editing_ensure()`. --- source/blender/editors/screen/screen_context.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/screen/screen_context.c') diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index d718c8b0d95..11a62123ad7 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -647,18 +647,20 @@ static eContextResult screen_ctx_selected_editable_sequences(const bContext *C, wmWindow *win = CTX_wm_window(C); Scene *scene = WM_window_get_active_scene(win); Editing *ed = SEQ_editing_get(scene); + if (ed == NULL) { + return CTX_RESULT_NO_DATA; + } + ListBase *channels = SEQ_channels_displayed_get(ed); - if (ed) { - LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) { - if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) { - CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq); - } + LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) { + if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) { + CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq); } - CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); - return CTX_RESULT_OK; } - return CTX_RESULT_NO_DATA; + CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); + return CTX_RESULT_OK; } + static eContextResult screen_ctx_active_nla_track(const bContext *C, bContextDataResult *result) { PointerRNA ptr; -- cgit v1.2.3