From 648f290dc1e5683f040dae0806393b01c1a65327 Mon Sep 17 00:00:00 2001 From: adam-m Date: Fri, 18 May 2012 12:16:07 -0400 Subject: [PATCH] Handle rare case when running solr query expected to have matches, yields no results and highlight is not fully initialized --- .../autopsy/keywordsearch/HighlightedMatchesSource.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedMatchesSource.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedMatchesSource.java index 79be0e73f7..dab04c0f8b 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedMatchesSource.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedMatchesSource.java @@ -240,11 +240,15 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup { @Override public boolean hasNextItem() { + if (!this.pagesToHits.containsKey(currentPage)) + return false; return this.pagesToHits.get(currentPage) < this.hitsPages.get(currentPage); } @Override public boolean hasPreviousItem() { + if (!this.pagesToHits.containsKey(currentPage)) + return false; return this.pagesToHits.get(currentPage) > 1; } @@ -270,6 +274,8 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup { @Override public int currentItem() { + if (!this.pagesToHits.containsKey(currentPage)) + return 0; return pagesToHits.get(currentPage); } @@ -383,6 +389,8 @@ class HighlightedMatchesSource implements MarkupSource, HighlightLookup { @Override public int getNumberHits() { + if (!this.hitsPages.containsKey(this.currentPage)) + return 0; return this.hitsPages.get(this.currentPage); }