瀏覽代碼

Fixed crash on missing campaign audio files

Ivan Savenko 1 年之前
父節點
當前提交
46fe6c1b09
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      client/CMusicHandler.cpp

+ 6 - 1
client/CMusicHandler.cpp

@@ -188,7 +188,12 @@ uint32_t CSoundHandler::getSoundDurationMilliseconds(const AudioPath & sound)
 	if (!initialized || sound.empty())
 		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;
 	uint32_t audioLen;