From cf9262f3d60965b00cbdbab37b3e31a92e5fd468 Mon Sep 17 00:00:00 2001 From: emmanue1 Date: Sun, 30 Jun 2019 09:09:11 +0200 Subject: [PATCH] Fix #250 : "Search function not working correctly" since 1.6.0 --- .../SearchInConstantPoolsController.java | 18 ++++++++++-------- .../jd/gui/view/SearchInConstantPoolsView.java | 1 - 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/jd/gui/controller/SearchInConstantPoolsController.java b/app/src/main/java/org/jd/gui/controller/SearchInConstantPoolsController.java index d0f9701..d87182b 100644 --- a/app/src/main/java/org/jd/gui/controller/SearchInConstantPoolsController.java +++ b/app/src/main/java/org/jd/gui/controller/SearchInConstantPoolsController.java @@ -291,15 +291,17 @@ public class SearchInConstantPoolsController implements IndexesChangeListener { if (matchedEntries == null) { Map index = indexes.getIndex(indexName); - if (patternLength == 1) { - matchedEntries = matchWithCharFunction.apply(pattern.charAt(0), index); - } else { - String lastKey = key.substring(0, key.length() - 1); - Map lastMatchedTypes = cache.get(lastKey); - if (lastMatchedTypes != null) { - matchedEntries = matchWithStringFunction.apply(pattern, lastMatchedTypes); + if (index != null) { + if (patternLength == 1) { + matchedEntries = matchWithCharFunction.apply(pattern.charAt(0), index); } else { - matchedEntries = matchWithStringFunction.apply(pattern, index); + String lastKey = key.substring(0, key.length() - 1); + Map lastMatchedTypes = cache.get(lastKey); + if (lastMatchedTypes != null) { + matchedEntries = matchWithStringFunction.apply(pattern, lastMatchedTypes); + } else { + matchedEntries = matchWithStringFunction.apply(pattern, index); + } } } diff --git a/app/src/main/java/org/jd/gui/view/SearchInConstantPoolsView.java b/app/src/main/java/org/jd/gui/view/SearchInConstantPoolsView.java index d6f4de8..ab9258a 100644 --- a/app/src/main/java/org/jd/gui/view/SearchInConstantPoolsView.java +++ b/app/src/main/java/org/jd/gui/view/SearchInConstantPoolsView.java @@ -250,7 +250,6 @@ public class SearchInConstantPoolsView