Fix crash scrubbing in the animation player with 1 frame loaded

Regression in caused an integer division by zero.

[0]: e6933e526c
This commit is contained in:
Campbell Barton
2024-09-14 12:36:14 +10:00
parent 95d29c9464
commit 9d47d5f8a3

View File

@@ -1066,7 +1066,7 @@ static void playanim_change_frame(PlayState *ps)
playanim_window_get_size(ps->ghost_data.window, &sizex, &sizey);
const int i_last = static_cast<PlayAnimPict *>(ps->picsbase.last)->frame;
/* Without this the frame-indicator location isn't closest to the cursor. */
const int correct_rounding = (sizex / i_last) / 2;
const int correct_rounding = (sizex / (i_last + 1)) / 2;
const int i = clamp_i((i_last * (ps->frame_cursor_x + correct_rounding)) / sizex, 0, i_last);
#ifdef WITH_AUDASPACE