Skip to content

Commit

Permalink
Fixes a crash when no mod folders are founded (#515)
Browse files Browse the repository at this point in the history
* Fixes a crash when no mod folders are founded

Hi

* lemme

---------

Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
  • Loading branch information
TheoDevelops and NexIsDumb authored Jan 2, 2025
1 parent 76c07ce commit 7488485
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/funkin/backend/assets/ModsFolder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ class ModsFolder {
public static function getModsList():Array<String> {
var mods:Array<String> = [];
#if MOD_SUPPORT
for(modFolder in FileSystem.readDirectory(modsPath)) {
final modsList:Array<String> = FileSystem.readDirectory(modsPath);

if (modsList == null || modsList.length <= 0)
return mods;

for (modFolder in modsList) {
if (FileSystem.isDirectory('${modsPath}${modFolder}')) {
mods.push(modFolder);
} else {
Expand Down Expand Up @@ -159,4 +164,4 @@ class ModsFolder {
return prepareModLibrary(libName, new ZipFolderLibrary(zipPath, libName, modName), force);
}
#end
}
}

0 comments on commit 7488485

Please sign in to comment.