From 9d47d5f8a365c360ded2ff87f299192a081e4d2e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 14 Sep 2024 12:36:14 +1000 Subject: [PATCH] Fix crash scrubbing in the animation player with 1 frame loaded Regression in caused an integer division by zero. [0]: e6933e526c5fa0793acae007f137b62d4a778466 --- source/blender/windowmanager/intern/wm_playanim.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_playanim.cc b/source/blender/windowmanager/intern/wm_playanim.cc index 075bd5fdac4..add88b149dd 100644 --- a/source/blender/windowmanager/intern/wm_playanim.cc +++ b/source/blender/windowmanager/intern/wm_playanim.cc @@ -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(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