From 48f2cbc06d70888e38056168b81afdf4bac202b9 Mon Sep 17 00:00:00 2001 From: Edo Date: Fri, 17 Mar 2023 13:24:00 +0000 Subject: [PATCH] [Maps]: Fix fatal crash (#837) --- src/Components/Modules/Maps.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index 27cd6e9c..dfa917f9 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -605,9 +605,15 @@ namespace Components FoundCustomMaps.clear(); Logger::Print("Scanning custom maps...\n"); - auto basePath = std::format("{}\\usermaps", (*Game::fs_basepath)->current.string); + std::filesystem::path basePath = (*Game::fs_basepath)->current.string; + basePath /= "usermaps"; - auto entries = Utils::IO::ListFiles(basePath); + if (!std::filesystem::exists(basePath)) + { + return; + } + + const auto entries = Utils::IO::ListFiles(basePath); for (const auto& entry : entries) {