From 97d981a1675e056ebeffd259b1265d1624c67e34 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Tue, 21 Jan 2025 15:29:10 +0100 Subject: [PATCH] Fix #133241: don't crash on Frame All in motion tracker dopesheet When there was an empty (no keyframes) track in the motion tracker's dopesheet, Blender would crash when running the Frame All operator. The issue was that the code computing the frame range was trying to access non-existant data on the empty track, leading to a null pointer dereference. This fixes the issue by guarding that code with a nullptr check. Pull Request: https://projects.blender.org/blender/blender/pulls/133371 --- source/blender/editors/space_clip/clip_dopesheet_ops.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.cc b/source/blender/editors/space_clip/clip_dopesheet_ops.cc index 66f92003241..862ecba4afa 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_ops.cc +++ b/source/blender/editors/space_clip/clip_dopesheet_ops.cc @@ -159,8 +159,10 @@ static int dopesheet_view_all_exec(bContext *C, wmOperator * /*op*/) int frame_min = INT_MAX, frame_max = INT_MIN; LISTBASE_FOREACH (MovieTrackingDopesheetChannel *, channel, &dopesheet->channels) { - frame_min = min_ii(frame_min, channel->segments[0]); - frame_max = max_ii(frame_max, channel->segments[channel->tot_segment]); + if (channel->segments) { + frame_min = min_ii(frame_min, channel->segments[0]); + frame_max = max_ii(frame_max, channel->segments[channel->tot_segment]); + } } if (frame_min < frame_max) {