diff options
| author | 2019-02-16 18:02:14 +0200 | |
|---|---|---|
| committer | 2019-02-16 18:02:14 +0200 | |
| commit | 0111f1ef56e33b682101b3072b831bebcdd0d998 (patch) | |
| tree | abca955d1eede33091c54fcf6deda1150368a591 /src | |
| parent | Don't save local variable entries with no mapping (diff) | |
| download | enigma-0111f1ef56e33b682101b3072b831bebcdd0d998.tar.gz enigma-0111f1ef56e33b682101b3072b831bebcdd0d998.tar.xz enigma-0111f1ef56e33b682101b3072b831bebcdd0d998.zip | |
Fix NPE dropping mappings
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/cuchaz/enigma/translation/mapping/tree/HashEntryTree.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/cuchaz/enigma/translation/mapping/tree/HashEntryTree.java b/src/main/java/cuchaz/enigma/translation/mapping/tree/HashEntryTree.java index fa9ed13d..c5fc473d 100644 --- a/src/main/java/cuchaz/enigma/translation/mapping/tree/HashEntryTree.java +++ b/src/main/java/cuchaz/enigma/translation/mapping/tree/HashEntryTree.java | |||
| @@ -115,16 +115,19 @@ public class HashEntryTree<T> implements EntryTree<T> { | |||
| 115 | 115 | ||
| 116 | Entry<?> rootEntry = ancestry.get(0); | 116 | Entry<?> rootEntry = ancestry.get(0); |
| 117 | HashTreeNode<T> node = make ? root.computeIfAbsent(rootEntry, HashTreeNode::new) : root.get(rootEntry); | 117 | HashTreeNode<T> node = make ? root.computeIfAbsent(rootEntry, HashTreeNode::new) : root.get(rootEntry); |
| 118 | if (node == null) { | ||
| 119 | return Collections.emptyList(); | ||
| 120 | } | ||
| 121 | |||
| 118 | path.add(node); | 122 | path.add(node); |
| 119 | 123 | ||
| 120 | for (int i = 1; i < ancestry.size(); i++) { | 124 | for (int i = 1; i < ancestry.size(); i++) { |
| 125 | Entry<?> ancestor = ancestry.get(i); | ||
| 126 | node = make ? node.computeChild(ancestor) : node.getChild(ancestor); | ||
| 121 | if (node == null) { | 127 | if (node == null) { |
| 122 | return Collections.emptyList(); | 128 | return Collections.emptyList(); |
| 123 | } | 129 | } |
| 124 | 130 | ||
| 125 | Entry<?> ancestor = ancestry.get(i); | ||
| 126 | node = make ? node.computeChild(ancestor) : node.getChild(ancestor); | ||
| 127 | |||
| 128 | path.add(node); | 131 | path.add(node); |
| 129 | } | 132 | } |
| 130 | 133 | ||