Apache Lucene open-source search software
Fix Potential NullPointException in BytesRefHash initialization (#15702)
tyronecai132ab0a88aaa
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 8d2c5556f4a..9bc40b40429 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -201,6 +201,7 @@ Bug Fixes* GITHUB#15668: Fix UnsupportedOperationException in WeightedSpanTermExtractor byimplementing getFieldInfos in DelegatingLeafReader. (Simranjeet Singh)+* GITHUB#15702: Fix Potential NullPointException in BytesRefHash initialization#15702 (tyronecai)Other---------------------diff --git a/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java b/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.javaindex 95683710b99..5d93426e8a2 100644--- a/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java+++ b/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java@@ -138,7 +138,7 @@ public final class BytesRefHash implements Accountable {bytesStart = bytesStartArray.init();final Counter bytesUsed = bytesStartArray.bytesUsed();this.bytesUsed = bytesUsed == null ? Counter.newCounter() : bytesUsed;- bytesUsed.addAndGet(hashSize * (long) Integer.BYTES);+ this.bytesUsed.addAndGet(hashSize * (long) Integer.BYTES);}/**