Skip to content

Commit 7488485

Browse files
theoo-hNexIsDumb
andauthored
Fixes a crash when no mod folders are founded (#515)
* Fixes a crash when no mod folders are founded Hi * lemme --------- Co-authored-by: ⍚~Nex <[email protected]>
1 parent 76c07ce commit 7488485

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

source/funkin/backend/assets/ModsFolder.hx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ class ModsFolder {
9393
public static function getModsList():Array<String> {
9494
var mods:Array<String> = [];
9595
#if MOD_SUPPORT
96-
for(modFolder in FileSystem.readDirectory(modsPath)) {
96+
final modsList:Array<String> = FileSystem.readDirectory(modsPath);
97+
98+
if (modsList == null || modsList.length <= 0)
99+
return mods;
100+
101+
for (modFolder in modsList) {
97102
if (FileSystem.isDirectory('${modsPath}${modFolder}')) {
98103
mods.push(modFolder);
99104
} else {
@@ -159,4 +164,4 @@ class ModsFolder {
159164
return prepareModLibrary(libName, new ZipFolderLibrary(zipPath, libName, modName), force);
160165
}
161166
#end
162-
}
167+
}

0 commit comments

Comments
 (0)