Apache Lucene open-source search software
For hnsw merger, do not pop from empty heap (#14420)
Benjamin Trentb5d13e29f143
diff --git a/lucene/core/src/java/org/apache/lucene/util/hnsw/UpdateGraphsUtils.java b/lucene/core/src/java/org/apache/lucene/util/hnsw/UpdateGraphsUtils.javaindex c1217175a43..408b529d6e1 100644--- a/lucene/core/src/java/org/apache/lucene/util/hnsw/UpdateGraphsUtils.java+++ b/lucene/core/src/java/org/apache/lucene/util/hnsw/UpdateGraphsUtils.java@@ -55,7 +55,7 @@ public class UpdateGraphsUtils {}long gTot = 0L;- while (gTot < gExit) {+ while (gTot < gExit && heap.size() > 0) {long el = heap.pop();int gain = decodeValue1(el);int v = decodeValue2(el);