From 296bbaaa52eca328af687de9ff599a7084ac2a74 Mon Sep 17 00:00:00 2001 From: Matt Wheeler Date: Tue, 28 Jan 2014 11:05:09 -0800 Subject: [PATCH] SENSEI-326 Fix NPE in ScoreAugmentQuery (when inner scorer is null) --- .../java/com/senseidb/search/query/ScoreAugmentQuery.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sensei-core/src/main/java/com/senseidb/search/query/ScoreAugmentQuery.java b/sensei-core/src/main/java/com/senseidb/search/query/ScoreAugmentQuery.java index 1870ec019..76c7f1ec8 100644 --- a/sensei-core/src/main/java/com/senseidb/search/query/ScoreAugmentQuery.java +++ b/sensei-core/src/main/java/com/senseidb/search/query/ScoreAugmentQuery.java @@ -125,7 +125,11 @@ public ScoreAugmentQuery(Query query, ScoreAugmentFunction func, JSONObject json @Override protected Scorer createScorer(Scorer innerScorer, AtomicReaderContext context) throws IOException { if (context.reader() instanceof BoboSegmentReader) { - return new AugmentScorer((BoboSegmentReader) context.reader(), innerScorer, _func.getCopy(), _jsonParam); + if (innerScorer != null) { + return new AugmentScorer((BoboSegmentReader) context.reader(), innerScorer, _func.getCopy(), _jsonParam); + } else { + return null; + } } else { throw new IllegalStateException("reader not instance of " + BoboSegmentReader.class); }