From 586b0b5177f8f94311985cc251e045fd7ec15a16 Mon Sep 17 00:00:00 2001 From: Sude Date: Sat, 22 Jul 2023 14:44:23 +0300 Subject: [PATCH] Assume .jpg extension for logo Should fix core dump caused by failing to get file extension for logo --- src/gamedetails.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gamedetails.cpp b/src/gamedetails.cpp index 6757fae..f73bfed 100644 --- a/src/gamedetails.cpp +++ b/src/gamedetails.cpp @@ -82,8 +82,13 @@ void gameDetails::makeFilepaths(const DirectoryConfig& config) std::string filepath; std::string directory = config.sDirectory + "/" + config.sGameSubdir + "/"; std::string subdir; + std::string logo_ext = ".jpg"; // Assume jpg + + if (this->logo.rfind(".") != std::string::npos) + logo_ext = this->logo.substr(this->logo.rfind(".")); + this->serialsFilepath = Util::makeFilepath(directory, "serials.txt", this->gamename, subdir, 0); - this->logoFilepath = Util::makeFilepath(directory, "logo" + this->logo.substr(this->logo.rfind(".")), this->gamename, subdir, 0); + this->logoFilepath = Util::makeFilepath(directory, "logo" + logo_ext, this->gamename, subdir, 0); this->changelogFilepath = Util::makeFilepath(directory, "changelog_" + gamename + ".html", this->gamename, subdir, 0); for (unsigned int i = 0; i < this->installers.size(); ++i) @@ -118,7 +123,7 @@ void gameDetails::makeFilepaths(const DirectoryConfig& config) { subdir = config.bSubDirectories ? config.sDLCSubdir + "/" + config.sInstallersSubdir : ""; this->dlcs[i].serialsFilepath = Util::makeFilepath(directory, "serials.txt", this->gamename, subdir, 0); - this->dlcs[i].logoFilepath = Util::makeFilepath(directory, "logo" + this->logo.substr(this->logo.rfind(".")), this->gamename, subdir, 0); + this->dlcs[i].logoFilepath = Util::makeFilepath(directory, "logo" + logo_ext, this->gamename, subdir, 0); this->dlcs[i].changelogFilepath = Util::makeFilepath(directory, "changelog_" + this->dlcs[i].gamename + ".html", this->gamename, subdir, 0); for (unsigned int j = 0; j < this->dlcs[i].installers.size(); ++j) {