From da15ef2841076f40d2b278cdaedc47e45fde32ec Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:36:19 -0700 Subject: [PATCH] Fix a crash in an anonymous buffer that copilot is writing to. (#60377) --- src/server/scriptVersionCache.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index 55a957928a1..1a0c8713db2 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -632,6 +632,7 @@ export class LineNode implements LineCollection { walk(rangeStart: number, rangeLength: number, walkFns: LineIndexWalker): void { // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars) + if (this.children.length === 0) return; let childIndex = 0; let childCharCount = this.children[childIndex].charCount(); // find sub-tree containing start