diff --git a/enigma-cli/src/test/resources/drop_invalid_mappings/input/EmptyMappings.mapping b/enigma-cli/src/test/resources/drop_invalid_mappings/input/EmptyMappings.mapping index 91bc828b..4ad14254 100644 --- a/enigma-cli/src/test/resources/drop_invalid_mappings/input/EmptyMappings.mapping +++ b/enigma-cli/src/test/resources/drop_invalid_mappings/input/EmptyMappings.mapping @@ -3,3 +3,6 @@ CLASS a METHOD (Ljava/lang/String;)V ARG 1 METHOD a ()Ljava/lang/String; + CLASS b + METHOD b (Ljava/lang/String;)V + ARG 2 diff --git a/enigma/src/main/java/org/quiltmc/enigma/api/EnigmaProject.java b/enigma/src/main/java/org/quiltmc/enigma/api/EnigmaProject.java index 35744982..bc060a7a 100644 --- a/enigma/src/main/java/org/quiltmc/enigma/api/EnigmaProject.java +++ b/enigma/src/main/java/org/quiltmc/enigma/api/EnigmaProject.java @@ -275,7 +275,7 @@ public boolean validateParameterIndex(LocalVariableEntry parameter) { .filter(node -> node.name.equals(parent.getName()) && node.desc.equals(parent.getDesc().toString())) .findFirst().ifPresent(node -> { // occasionally it's possible to run into a method that has parameters, yet whose max locals is 0. java is stupid. we ignore those cases - if (node.parameters.size() <= node.maxLocals) { + if (!(node.parameters != null && node.parameters.size() > node.maxLocals)) { maxLocals.set(node.maxLocals); } }); diff --git a/enigma/src/main/java/org/quiltmc/enigma/impl/translation/mapping/MappingsChecker.java b/enigma/src/main/java/org/quiltmc/enigma/impl/translation/mapping/MappingsChecker.java index 89b0fab1..30c9bfa2 100644 --- a/enigma/src/main/java/org/quiltmc/enigma/impl/translation/mapping/MappingsChecker.java +++ b/enigma/src/main/java/org/quiltmc/enigma/impl/translation/mapping/MappingsChecker.java @@ -116,7 +116,10 @@ private boolean hasNoChildren(Entry entry, Dropped dropped) { // account for child mappings that have been dropped already if (!children.isEmpty()) { for (Entry child : children) { - if (!dropped.getDroppedMappings().containsKey(child) && !this.hasNoChildren(child, dropped)) { + var mapping = this.mappings.get(child); + if (mapping != null && !(mapping.targetName() == null && mapping.javadoc() == null)) { + return false; + } else if (!dropped.getDroppedMappings().containsKey(child) && this.hasNoChildren(child, dropped)) { return true; } }