Permalink
Browse files

Applying patch suggested by https://github.com/KciNKh to fix issue #14

  • Loading branch information...
1 parent aee0034 commit d38e549789d7df8678be97f16b98aa893545a12c @chirino chirino committed Feb 6, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/JniDBIterator.java
@@ -112,7 +112,11 @@ public boolean hasPrev() {
try {
return iterator.isValid();
} finally {
- iterator.next();
+ if (iterator.isValid()) {
+ iterator.next();
+ } else {
+ iterator.seekToFirst();
+ }
}
} catch (NativeDB.DBException e) {
throw new RuntimeException(e);
@@ -125,7 +129,11 @@ public boolean hasPrev() {
try {
return peekNext();
} finally {
- iterator.next();
+ if (iterator.isValid()) {
+ iterator.next();
+ } else {
+ iterator.seekToFirst();
+ }
}
} catch (NativeDB.DBException e) {
throw new RuntimeException(e);

0 comments on commit d38e549

Please sign in to comment.