Skip to content

Commit 0b66d32

Browse files
Wedge009Pentarctagon
authored andcommitted
Log missing sound files instead of crashing. Resolves wesnoth#11316.
1 parent 2f99e18 commit 0b66d32

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/sound.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,10 @@ static void play_sound_internal(const std::string& files,
841841

842842
std::string file = pick_one(files);
843843
const auto filename = filesystem::get_binary_file_location("sounds", file);
844+
if(!filename) {
845+
ERR_AUDIO << "Could not locate sound file '" << file << "'.";
846+
return;
847+
}
844848
const auto localized = filesystem::get_localized_path(filename.value_or(""));
845849
std::string real_path = localized.value_or(filename.value());
846850

0 commit comments

Comments
 (0)