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
This commit is contained in:
Nathan Vegdahl 2025-01-21 15:29:10 +01:00 committed by Nathan Vegdahl
parent b2a06888c7
commit 97d981a167

View file

@ -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) {