From 098b2252d05b04a1f2d23473002ce88e4e653903 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 6 Jul 2022 04:39:12 -0700 Subject: [PATCH] Prevent exception when deleting non-existent element Fixes #3885 --- src/common/SortedList.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/SortedList.ts b/src/common/SortedList.ts index 051c6702..975dc204 100644 --- a/src/common/SortedList.ts +++ b/src/common/SortedList.ts @@ -35,6 +35,9 @@ export class SortedList { } const key = this._getKey(value); let i = this._search(key, 0, this._array.length - 1); + if (i === -1) { + return false; + } if (this._getKey(this._array[i]) !== key) { return false; }