diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-11-09 04:26:02 (GMT) |
---|---|---|
committer | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-11-09 04:26:02 (GMT) |
commit | f55c317e377aaf0b3e24904e88dc1c4a6e15a20a (patch) | |
tree | 84eebcd04d8a390ee27e4e89c768d7f8432f1346 /src/multimedia | |
parent | 5989d15f73da71b69a27129349a07a15954a8853 (diff) | |
download | Qt-f55c317e377aaf0b3e24904e88dc1c4a6e15a20a.zip Qt-f55c317e377aaf0b3e24904e88dc1c4a6e15a20a.tar.gz Qt-f55c317e377aaf0b3e24904e88dc1c4a6e15a20a.tar.bz2 |
Fixed runtime error in QAudioInput::bytesReady() function
If bytesReady() was called before start(), Div by Zero.
Added check for this condition.
Task-number:QTBUG-5300
Reviewed-by:Justin McPherson
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 31f6e25..b7f9ffd 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -333,6 +333,9 @@ void QAudioInputPrivate::close() int QAudioInputPrivate::bytesReady() const { + if(period_size == 0 || buffer_size == 0) + return 0; + int buf = ((buffer_size/period_size)-waveFreeBlockCount)*period_size; if(buf < 0) buf = 0; |