aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL
diff options
context:
space:
mode:
authorH0L0 <H0L0.Business@outlook.com>2023-10-16 06:12:02 +1000
committerGitHub <noreply@github.com>2023-10-15 22:12:02 +0200
commitf24089e2d79443962c736ff4651d97e7a97bd952 (patch)
tree2275ba78aaf5ea3b4c9d3748af98298f3c9b0866 /NorthstarDLL
parent98af0dcbb45972d4af22ea0d26a3a2c518ea9b13 (diff)
downloadNorthstarLauncher-f24089e2d79443962c736ff4651d97e7a97bd952.tar.gz
NorthstarLauncher-f24089e2d79443962c736ff4651d97e7a97bd952.zip
Add check for r2/maps folder (#575)
Adds a fix to check if `r2/maps` folder exists before trying to iterate through it.
Diffstat (limited to 'NorthstarDLL')
-rw-r--r--NorthstarDLL/util/printmaps.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/NorthstarDLL/util/printmaps.cpp b/NorthstarDLL/util/printmaps.cpp
index dd825bff..5b406c4c 100644
--- a/NorthstarDLL/util/printmaps.cpp
+++ b/NorthstarDLL/util/printmaps.cpp
@@ -104,7 +104,13 @@ void RefreshMapList()
}
// get maps in game dir
- for (fs::directory_entry file : fs::directory_iterator(fmt::format("{}/maps", R2::g_pModName)))
+ std::string gameDir = fmt::format("{}/maps", R2::g_pModName);
+ if (!std::filesystem::exists(gameDir))
+ {
+ return;
+ }
+
+ for (fs::directory_entry file : fs::directory_iterator(gameDir))
{
if (file.path().extension() == ".bsp")
{