diff --git a/package.json b/package.json index 8686b9301..49c954134 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lmdb", "author": "Kris Zyp", - "version": "2.10.0-beta.2", + "version": "2.10.0-beta.3", "description": "Simple, efficient, scalable, high-performance LMDB interface", "license": "MIT", "repository": { diff --git a/read.js b/read.js index 19a84bca1..0dfafba3d 100644 --- a/read.js +++ b/read.js @@ -490,7 +490,7 @@ export function addReadMethods(LMDBStore, { } function finishCursor() { - if (txn.isDone) + if (!cursor || txn.isDone) return; if (iterable.onDone) iterable.onDone() @@ -511,6 +511,7 @@ export function addReadMethods(LMDBStore, { db.cursorTxn = txn; } } + cursor = null; } return { next() { @@ -519,6 +520,9 @@ export function addReadMethods(LMDBStore, { resetCursor(); keySize = position(0); } + if (!cursor) { + return ITERATOR_DONE; + } if (count === 0) { // && includeValues) // on first entry, get current value if we need to keySize = position(options.offset); } else