From 456febce1cfd54c3a6f04409b2c4f4358c373db4 Mon Sep 17 00:00:00 2001 From: mathusummut Date: Tue, 19 Mar 2019 23:46:37 +0100 Subject: [PATCH] Fixed audio bug --- .../shared_lib/sources/sound/openal/sound_player_openal.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp index 08240a742..69827661e 100644 --- a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp +++ b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp @@ -542,7 +542,8 @@ namespace Shared { try { StreamSoundSource* source = findStreamSoundSource(); - source->play(strSound, fadeOn); + if (source != NULL) + source->play(strSound, fadeOn); } catch (std::exception& e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what()); std::cerr << "Couldn't play streaming sound: " << e.what() << "\n"; @@ -656,7 +657,8 @@ namespace Shared { // create a new source if (streamSources.size() >= params.strBufferCount) { - throw std::runtime_error("Too many stream sounds played at once"); + //throw std::runtime_error("Too many stream sounds played at once"); + return NULL; } if (SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__);