[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] 04/05: idb-bridge: fix deletion
From: |
gnunet |
Subject: |
[taler-wallet-core] 04/05: idb-bridge: fix deletion |
Date: |
Thu, 21 Nov 2019 23:10:03 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
commit e8f362ccfea683fe16ce68b956f068ffa0b001b1
Author: Florian Dold <address@hidden>
AuthorDate: Thu Nov 21 20:39:53 2019 +0100
idb-bridge: fix deletion
---
packages/idb-bridge/package.json | 2 +-
packages/idb-bridge/src/MemoryBackend.ts | 12 ++++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/packages/idb-bridge/package.json b/packages/idb-bridge/package.json
index 19c28245..6df8ab34 100644
--- a/packages/idb-bridge/package.json
+++ b/packages/idb-bridge/package.json
@@ -1,6 +1,6 @@
{
"name": "idb-bridge",
- "version": "0.0.13",
+ "version": "0.0.14",
"description": "IndexedDB implementation that uses SQLite3 as storage",
"main": "./build/index.js",
"types": "./build/index.d.ts",
diff --git a/packages/idb-bridge/src/MemoryBackend.ts
b/packages/idb-bridge/src/MemoryBackend.ts
index 792ae4cd..cee06197 100644
--- a/packages/idb-bridge/src/MemoryBackend.ts
+++ b/packages/idb-bridge/src/MemoryBackend.ts
@@ -871,14 +871,22 @@ export class MemoryBackend implements Backend {
} else {
currKey = range.lower;
// We have a range with an lowerOpen lower bound, so don't start
- // deleting the upper bound. Instead start with the next higher key.
+ // deleting the lower bound. Instead start with the next higher key.
if (range.lowerOpen && currKey !== undefined) {
currKey = modifiedData.nextHigherKey(currKey);
}
}
- // invariant: (currKey is undefined) or (currKey is a valid key)
+ // make sure that currKey is either undefined or pointing to an
+ // existing object.
+ let firstValue = modifiedData.get(currKey);
+ if (!firstValue) {
+ if (currKey !== undefined) {
+ currKey = modifiedData.nextHigherKey(currKey);
+ }
+ }
+ // loop invariant: (currKey is undefined) or (currKey is a valid key)
while (true) {
if (currKey === undefined) {
// nothing more to delete!
--
To stop receiving notification emails like this one, please contact
address@hidden.