1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-23 12:08:45 +02:00

Fixed crash on missing campaign audio files

This commit is contained in:
Ivan Savenko 2024-02-01 18:08:01 +02:00
parent facdc9f993
commit 46fe6c1b09

View File

@ -188,7 +188,12 @@ uint32_t CSoundHandler::getSoundDurationMilliseconds(const AudioPath & sound)
if (!initialized || sound.empty()) if (!initialized || sound.empty())
return 0; return 0;
auto data = CResourceHandler::get()->load(sound.addPrefix("SOUNDS/"))->readAll(); auto resourcePath = sound.addPrefix("SOUNDS/");
if (!CResourceHandler::get()->existsResource(resourcePath))
return 0;
auto data = CResourceHandler::get()->load(resourcePath)->readAll();
SDL_AudioSpec spec; SDL_AudioSpec spec;
uint32_t audioLen; uint32_t audioLen;