From 253f537bb260671c704861fb2fe824ad24d0e53d Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Fri, 11 Jun 2021 12:11:45 +0200 Subject: [PATCH] Fixed an exception when the target server is unknown --- shared/js/connectionlog/History.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared/js/connectionlog/History.ts b/shared/js/connectionlog/History.ts index 5e2abee1..b4225916 100644 --- a/shared/js/connectionlog/History.ts +++ b/shared/js/connectionlog/History.ts @@ -480,11 +480,16 @@ export class ConnectionHistory { const store = transaction.objectStore("attempt-history"); const cursor = await new Promise((resolve, reject) => { - const cursor = store.index(targetType === "server-unique-id" ? "serverUniqueId" : "targetAddress").openCursor(target, "prev");; + const cursor = store.index(targetType === "server-unique-id" ? "serverUniqueId" : "targetAddress").openCursor(target, "prev"); cursor.onsuccess = () => resolve(cursor.result); cursor.onerror = () => reject(cursor.error); }); + if(!cursor) { + /* We did not find any entry */ + return undefined; + } + while(true) { if(!cursor.value) { return undefined;