changeset 1416:d794630429a7

Fix potential divide-by-zero
author Chris Cannam
date Mon, 21 Jan 2019 10:08:26 +0000
parents 89d124ac9bfa
children 2487521e857b
files view/View.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/view/View.cpp	Mon Jan 21 10:07:36 2019 +0000
+++ b/view/View.cpp	Mon Jan 21 10:08:26 2019 +0000
@@ -1158,7 +1158,10 @@
 
             sv_frame_t w = getEndFrame() - getStartFrame();
             w -= w/5;
-            sv_frame_t sf = (m_playPointerFrame / w) * w - w/8;
+            sv_frame_t sf = m_playPointerFrame;
+            if (w > 0) {
+                sf = (sf / w) * w - w/8;
+            }
 
             if (m_manager &&
                 m_manager->isPlaying() &&