From a793b6d9386e81c0fc1d144f0c9fa5b220997d6e Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Sun, 12 Nov 2023 09:55:12 +0100 Subject: [PATCH] Fix `LoadPO` for English (empty filename). --- src/stratagus/translate.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stratagus/translate.cpp b/src/stratagus/translate.cpp index 074237aa58..ee59f51a1b 100644 --- a/src/stratagus/translate.cpp +++ b/src/stratagus/translate.cpp @@ -74,11 +74,18 @@ const std::string& Plural(const std::string& str, std::size_t count) */ void LoadPO(const fs::path& filename) { + if (filename.empty()) { // Typically English + return; + } const fs::path fullfilename = LibraryFileName(filename.string()); DebugPrint( "LoadPO(\"%s\") -> \"%s\"\n", filename.u8string().c_str(), fullfilename.u8string().c_str()); std::ifstream poFile(fullfilename); + if (!poFile) { + ErrorPrint("Cannot open '%s'\n", fullfilename.u8string().c_str()); + return; + } catalog.Add(poFile); }