mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
skiplist: Sanity check inserted entries
This commit is contained in:
parent
9e2ef6ad5b
commit
e2eb7327c2
4 changed files with 29 additions and 0 deletions
|
@ -95,6 +95,11 @@ class Point {
|
|||
}
|
||||
|
||||
insert(entry) {
|
||||
if (entry.key == null) throw new Error('entry.key must not be null');
|
||||
if (this._skipList.containsKey(entry.key)) {
|
||||
throw new Error(`an entry with key ${entry.key} already exists`);
|
||||
}
|
||||
|
||||
const newNode = new Node(entry);
|
||||
const pNodes = this.nodes;
|
||||
const pIdxs = this.idxs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue