From fee9bfebfafbc5195db2c0ec06586bce42b25120 Mon Sep 17 00:00:00 2001 From: MysterD Date: Wed, 16 Mar 2022 01:55:25 -0700 Subject: [PATCH 1/2] Fix segfault when using defaultModsPath on Windows --- src/pc/mods/mods.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pc/mods/mods.c b/src/pc/mods/mods.c index 03bb2b4f..d04b9e35 100644 --- a/src/pc/mods/mods.c +++ b/src/pc/mods/mods.c @@ -147,7 +147,10 @@ void mods_init(void) { // load mods if (hasUserPath) { mods_load(&gLocalMods, userModPath); } - mods_load(&gLocalMods, "./" MOD_DIRECTORY); + char defaultModsPath[SYS_MAX_PATH] = { 0 }; + if (snprintf(defaultModsPath, SYS_MAX_PATH - 1, "%s", "./" MOD_DIRECTORY) >= 0) { + mods_load(&gLocalMods, defaultModsPath); + } // calculate total size gLocalMods.size = 0; From 7acfede111e192530e62568b4ad10f24a6c9f186 Mon Sep 17 00:00:00 2001 From: MysterD Date: Wed, 16 Mar 2022 09:36:14 -0700 Subject: [PATCH 2/2] Fix crash with mod folders that don't have actors --- src/pc/mods/mod.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pc/mods/mod.c b/src/pc/mods/mod.c index 295bbf12..79b37b29 100644 --- a/src/pc/mods/mod.c +++ b/src/pc/mods/mod.c @@ -167,8 +167,7 @@ static bool mod_load_files(struct Mod* mod, char* modName, char* fullPath) { struct dirent* dir = NULL; DIR* d = opendir(actorsPath); if (!d) { - LOG_ERROR("Could not open directory '%s'", actorsPath); - return false; + return true; } // iterate mod directory