From f24089e2d79443962c736ff4651d97e7a97bd952 Mon Sep 17 00:00:00 2001 From: H0L0 Date: Mon, 16 Oct 2023 06:12:02 +1000 Subject: Add check for r2/maps folder (#575) Adds a fix to check if `r2/maps` folder exists before trying to iterate through it. --- NorthstarDLL/util/printmaps.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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") { -- cgit v1.2.3