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

Signed-off-by: cpw <[email protected]>
This commit is contained in:
cpw committed 2019-01-26 17:07:17 -05:00
1 parent c578cae676
commit d539dc12a1
1 file changed
+5 -2
@@ -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()) {