diff --git a/jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/client/DefaultRheaIterator.java b/jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/client/DefaultRheaIterator.java index e2b3b4644..e00c857ce 100644 --- a/jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/client/DefaultRheaIterator.java +++ b/jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/client/DefaultRheaIterator.java @@ -58,7 +58,8 @@ public DefaultRheaIterator(DefaultRheaKVStore rheaKVStore, byte[] startKey, byte @Override public synchronized boolean hasNext() { if (this.buf.isEmpty()) { - while (this.endKey == null || BytesUtil.compare(this.cursorKey, this.endKey) < 0) { + while (this.endKey == null || (cursorKey != null //fix issue #990 + && BytesUtil.compare(this.cursorKey, this.endKey) < 0)) { final List kvEntries = this.rheaKVStore.singleRegionScan(this.cursorKey, this.endKey, this.bufSize, this.readOnlySafe, this.returnValue); if (kvEntries.isEmpty()) {