check parent range when creating selection range, #67872

This commit is contained in:
Johannes Rieken
2019-03-12 10:19:52 +01:00
parent a2f6ec675d
commit 8579e43df1
2 changed files with 12 additions and 12 deletions

View File

@@ -1103,6 +1103,10 @@ export class SelectionRange {
constructor(range: Range, parent?: SelectionRange) {
this.range = range;
this.parent = parent;
if (parent && !parent.range.contains(this.range)) {
throw new Error('Invalid argument: parent must contain this range');
}
}
}