From 8853fded2953959317380e4099d43db7b2f57d4a Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 27 Jul 2021 14:22:04 +0100 Subject: [PATCH] play-audio-sample command: check path Don't try to play missing paths. --- src/Sound/soundmanager.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Sound/soundmanager.cxx b/src/Sound/soundmanager.cxx index a78a79514..c96909adb 100644 --- a/src/Sound/soundmanager.cxx +++ b/src/Sound/soundmanager.cxx @@ -212,6 +212,13 @@ bool FGSoundManager::playAudioSampleCommand(const SGPropertyNode * arg, SGProper string path = arg->getStringValue("path"); string file = arg->getStringValue("file"); float volume = arg->getFloatValue("volume"); + + SGPath foundPath = globals->resolve_maybe_aircraft_path(path); + if (!foundPath.exists()) { + SG_LOG(SG_GENERAL, SG_ALERT, "play-audio-sample: no such file:'" << path << "'"); + return false; + } + // cout << "playing " << path << " / " << file << endl; try { if ( !_queue[name] ) {