From dabc2b23a395bda91e4114df65072e0b98269e35 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 10 Nov 2014 15:51:56 -0800 Subject: [PATCH] add a guard in case local audio cannot be handled --- interface/src/Audio.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 4a488bb296..43ad14aca7 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -1342,8 +1342,11 @@ void Audio::handleAudioByteArray(const QByteArray& audioByteArray, const AudioIn QAudioOutput* localSoundOutput = new QAudioOutput(getNamedAudioDeviceForMode(QAudio::AudioOutput, _outputAudioDeviceName), localFormat, this); QIODevice* localIODevice = localSoundOutput->start(); - qDebug() << "Writing" << audioByteArray.size() << "to" << localIODevice; - localIODevice->write(audioByteArray); + if (localIODevice) { + localIODevice->write(audioByteArray); + } else { + qDebug() << "Unable to handle audio byte array. Error:" << localSoundOutput->error(); + } } else { qDebug() << "Audio::handleAudioByteArray called with an empty byte array. Sound is likely still downloading."; }