Skip to content

Commit

Permalink
fixed null error when a mod had no dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
xChipseq committed Feb 8, 2025
1 parent 6c8b820 commit 6d46d05
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
7 changes: 3 additions & 4 deletions Dropship/Data/mods.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"Name" : "Mira API",
"Author" : "All-Of-Us-Mods",
"Releases" : "https://api.github.com/repos/All-Of-Us-Mods/MiraAPI/releases",
"Dependencies" : {},
"Dependencies" : {
"Reactor" : "2.3.1"
},
"Versioning" : {}
},

Expand All @@ -29,14 +31,12 @@
"Name" : "Submerged",
"Author" : "SubmergedAmongUs",
"Releases" : "https://api.github.com/repos/SubmergedAmongUs/Submerged/releases",
"Dependencies" : {},
"Versioning" : {}
},
"BetterPolus" : {
"Name" : "Better Polus",
"Author" : "Brybry16",
"Releases" : "https://api.github.com/repos/Brybry16/BetterPolus/releases",
"Dependencies" : {},
"Versioning" : {}
},

Expand All @@ -53,7 +53,6 @@
"Name" : "AUnlocker",
"Author" : "astra1dev",
"Releases" : "https://api.github.com/repos/astra1dev/AUnlocker/releases",
"Dependencies" : {},
"Versioning" : {}
},

Expand Down
17 changes: 10 additions & 7 deletions Dropship/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,22 @@ public static async Task<bool> DownloadMod(string modName, string version, bool
contentStream.Close();

// Check for dependencies
if (mod.Dependencies.Count > 0 && !dependency)
if (mod.Dependencies != null && !dependency)
{
Console.WriteLine("\nChecking for dependencies...");

foreach (var d in mod.Dependencies)
if (mod.Dependencies.Count > 0)
{
if (!IsModDownloaded(d.Value, d.Key))

foreach (var d in mod.Dependencies)
{
await DownloadMod(d.Key, d.Value, true);
if (!IsModDownloaded(d.Value, d.Key))
{
await DownloadMod(d.Key, d.Value, true);
}
}
}

Console.WriteLine("\nAll dependencies installed");
Console.WriteLine("\nAll dependencies installed");
}
}

if (!dependency)
Expand Down

0 comments on commit 6d46d05

Please sign in to comment.