From 2960f67bebf3c530793983ee6835c416481fe408 Mon Sep 17 00:00:00 2001 From: NoiseByNorthwest Date: Wed, 2 Jan 2013 22:10:46 +0100 Subject: [PATCH] AudioFileProcessor: fixed crash for samples with zero length This is a fix for #3598536. Closes #3598536. Signed-off-by: Tobias Doerffel --- plugins/audio_file_processor/audio_file_processor.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index c97aa2c7a..208a03d9d 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -542,7 +542,15 @@ AudioFileProcessorWaveView::AudioFileProcessorWaveView( QWidget * _parent, int _ void AudioFileProcessorWaveView::isPlaying( f_cnt_t _frames_played ) { - m_framesPlayed = _frames_played % ( m_sampleBuffer.endFrame() - m_sampleBuffer.startFrame() ); + const f_cnt_t nb_frames = m_sampleBuffer.endFrame() - m_sampleBuffer.startFrame(); + if( nb_frames < 1 ) + { + m_framesPlayed = 0; + } + else + { + m_framesPlayed = _frames_played % nb_frames; + } update(); }