Skip to content

Commit

Permalink
Fix NPE in RemapUnpickDefinitionsTask.
Browse files Browse the repository at this point in the history
Closes #3575

Co-authored-by: Cat Core <[email protected]>
  • Loading branch information
modmuss50 and thecatcore committed Aug 2, 2023
1 parent c073210 commit 7dd0801
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion filament/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
filament_version=0.6.1
filament_version=0.6.2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.UncheckedIOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import javax.inject.Inject;

Expand Down Expand Up @@ -102,19 +103,35 @@ public void execute() {
final int toM = mappingTree.getNamespaceId(getParameters().getTargetNamespace().get());

for (MappingTree.ClassMapping classDef : mappingTree.getClasses()) {
classMappings.put(classDef.getName(fromM), classDef.getName(toM));
final String classFromName = classDef.getName(fromM);

if (classFromName == null) {
continue;
}

classMappings.put(
classFromName,
Objects.requireNonNull(classDef.getName(toM), "Null to name: " + classFromName)
);

for (MappingTree.MethodMapping methodDef : classDef.getMethods()) {
methodMappings.put(
new MethodKey(classDef.getName(fromM), methodDef.getName(fromM), methodDef.getDesc(fromM)),
methodDef.getName(toM)
new MethodKey(
Objects.requireNonNull(classFromName, "Null dst name: " + classDef.getSrcName()),
Objects.requireNonNull(methodDef.getName(fromM), "Null dst name: " + methodDef.getSrcName()),
Objects.requireNonNull(methodDef.getDesc(fromM), "Null dst name: " + methodDef.getSrcName())
),
Objects.requireNonNull(methodDef.getName(toM), "Null to name: " + methodDef.getSrcName())
);
}

for (MappingTree.FieldMapping fieldDef : classDef.getFields()) {
fieldMappings.put(
new FieldKey(classDef.getName(fromM), fieldDef.getName(fromM)),
fieldDef.getName(toM)
new FieldKey(
Objects.requireNonNull(classFromName, "Null dst name: " + classDef.getSrcName()),
Objects.requireNonNull(fieldDef.getName(fromM), "Null dst name: " + fieldDef.getSrcName())
),
Objects.requireNonNull(fieldDef.getName(toM), "Null to name: " + fieldDef.getSrcName())
);
}
}
Expand Down

0 comments on commit 7dd0801

Please sign in to comment.