Skip to content

Commit

Permalink
fix an NPE when proposing a null mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed Jan 10, 2025
1 parent d238953 commit 18134da
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.quiltmc.enigma.api.translation.representation.entry.Entry;
import org.quiltmc.enigma.api.translation.representation.entry.MethodEntry;
import org.quiltmc.enigma.util.validation.ValidationContext;
import org.tinylog.Logger;

import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -149,9 +150,16 @@ public void insertDynamicallyProposedMappings(@Nullable Entry<?> obfEntry, @Null
// due to unchecked proposal, proposers are allowed to insert other token types
// when deobfuscated, they must be put in the main tree
proposedNames.forEach((entry, mapping) -> {
if (entry == null) {
Logger.warn("Name proposer '" + service.getId() + "' proposed a mapping (" + mapping + ") attached to a null entry!");
return;
}

service.validateProposedMapping(entry, mapping, true);

if (mapping.tokenType() == TokenType.DEOBFUSCATED) {
if (mapping == null) {
this.proposedMappings.remove(entry);
} else if (mapping.tokenType() == TokenType.DEOBFUSCATED) {
this.mappings.insert(entry, mapping);
} else {
this.proposedMappings.insert(entry, mapping);
Expand Down

0 comments on commit 18134da

Please sign in to comment.