Fixed division by zero (OSHI-) in audio display code.

Originally committed to SVN as r1795.
This commit is contained in:
Rodrigo Braz Monteiro 2008-01-20 20:09:49 +00:00
parent efc04d9e4c
commit 8ce9d53757

View file

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