From 8aa8908e1881e5ffaff2dc256e135b7b743ed607 Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Mon, 10 Feb 2025 23:04:37 -0700 Subject: [PATCH] Throw if the db is closed --- package.json | 2 +- read.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index df74aa3f6..05c556c19 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lmdb", "author": "Kris Zyp", - "version": "3.2.5", + "version": "3.2.6", "description": "Simple, efficient, scalable, high-performance LMDB interface", "license": "MIT", "repository": { diff --git a/read.js b/read.js index 0587d5501..096347c40 100644 --- a/read.js +++ b/read.js @@ -416,6 +416,7 @@ export function addReadMethods( }, attemptLock(id, version, callback) { + if (!env.address) throw new Error('Can not operate on a closed database'); keyBytes.dataView.setUint32(0, this.db.dbi); keyBytes.dataView.setFloat64(4, version); let keySize = this.writeKey(id, keyBytes, 12); @@ -423,6 +424,7 @@ export function addReadMethods( }, unlock(id, version, onlyCheck) { + if (!env.address) throw new Error('Can not operate on a closed database'); keyBytes.dataView.setUint32(0, this.db.dbi); keyBytes.dataView.setFloat64(4, version); let keySize = this.writeKey(id, keyBytes, 12);