Skip to content

Commit 8aa8908

Browse files
committed
Throw if the db is closed
1 parent 5485196 commit 8aa8908

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lmdb",
33
"author": "Kris Zyp",
4-
"version": "3.2.5",
4+
"version": "3.2.6",
55
"description": "Simple, efficient, scalable, high-performance LMDB interface",
66
"license": "MIT",
77
"repository": {

read.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,15 @@ export function addReadMethods(
416416
},
417417

418418
attemptLock(id, version, callback) {
419+
if (!env.address) throw new Error('Can not operate on a closed database');
419420
keyBytes.dataView.setUint32(0, this.db.dbi);
420421
keyBytes.dataView.setFloat64(4, version);
421422
let keySize = this.writeKey(id, keyBytes, 12);
422423
return attemptLock(env.address, keySize, callback);
423424
},
424425

425426
unlock(id, version, onlyCheck) {
427+
if (!env.address) throw new Error('Can not operate on a closed database');
426428
keyBytes.dataView.setUint32(0, this.db.dbi);
427429
keyBytes.dataView.setFloat64(4, version);
428430
let keySize = this.writeKey(id, keyBytes, 12);

0 commit comments

Comments
 (0)