From 8ce9d5375754ea449b907ff51c91550aa1848df4 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sun, 20 Jan 2008 20:09:49 +0000 Subject: [PATCH] Fixed division by zero (OSHI-) in audio display code. Originally committed to SVN as r1795. --- aegisub/audio_display.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aegisub/audio_display.cpp b/aegisub/audio_display.cpp index 168654ac4..7fd7e73f9 100644 --- a/aegisub/audio_display.cpp +++ b/aegisub/audio_display.cpp @@ -101,6 +101,7 @@ AudioDisplay::AudioDisplay(wxWindow *parent) provider = NULL; player = NULL; hold = 0; + samples = 0; hasFocus = (wxWindow::FindFocus() == this); // Init @@ -1914,8 +1915,10 @@ void AudioDisplay::OnSize(wxSizeEvent &event) { h -= Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0; // Update image - UpdateSamples(); - UpdatePosition(PositionSample / samples); + if (samples) { + UpdateSamples(); + UpdatePosition(PositionSample / samples); + } UpdateImage(); // Update scrollbar