summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2009-11-09 04:26:02 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2009-11-10 03:57:18 (GMT)
commitca199c62e0a0da82ac086eea1462073d519ea7e9 (patch)
tree0c55d5ef4d8380ec45c6457a40b033dc45cbd579
parent75fb85bbf1b2dc473f99da72124daa65c5839e01 (diff)
downloadQt-ca199c62e0a0da82ac086eea1462073d519ea7e9.zip
Qt-ca199c62e0a0da82ac086eea1462073d519ea7e9.tar.gz
Qt-ca199c62e0a0da82ac086eea1462073d519ea7e9.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
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp3
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;