Skip to content

Commit 1a7a587

Browse files
mmoreartymhegazy
authored andcommitted
Fix TokenOrIdentifierObject.getText() crash (microsoft#19673)
TokenOrIdentifierObject.getText() needs to pass `sourceFile` as an argument to `getStart()`. Fixes microsoft#19670
1 parent ba98cbb commit 1a7a587

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/services/services.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ namespace ts {
276276
}
277277

278278
public getText(sourceFile?: SourceFile): string {
279-
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
279+
if (!sourceFile) {
280+
sourceFile = this.getSourceFile();
281+
}
282+
return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd());
280283
}
281284

282285
public getChildCount(): number {

0 commit comments

Comments
 (0)