Fix modsorter to not crash on soft dependencies that don't exist.

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
cpw 2019-01-26 17:07:17 -05:00
parent c578cae676
commit d539dc12a1
No known key found for this signature in database
GPG Key ID: 8EB3DF749553B1B7
1 changed files with 5 additions and 2 deletions

View File

@ -123,8 +123,11 @@ public class ModSorter
@SuppressWarnings("UnstableApiUsage")
private void addDependency(MutableGraph<ModFileInfo> topoGraph, IModInfo.ModVersion dep)
{
ModFileInfo self = (ModFileInfo)dep.getOwner().getOwningFile();
ModFileInfo target = modIdNameLookup.get(dep.getModId()).getOwningFile();
final ModFileInfo self = (ModFileInfo)dep.getOwner().getOwningFile();
final ModInfo targetModInfo = modIdNameLookup.get(dep.getModId());
// soft dep that doesn't exist. Just return. No edge required.
if (targetModInfo == null) return;
final ModFileInfo target = targetModInfo.getOwningFile();
if (self == target)
return; // in case a jar has two mods that have dependencies between
switch (dep.getOrdering()) {