Add better checks for start index and length

This commit is contained in:
Daniel Imms
2021-06-15 03:34:45 -07:00
committed by Johannes Rieken
parent e169d55ba3
commit 084fb5e7bf

View File

@@ -1713,10 +1713,10 @@ export class TerminalLink implements vscode.TerminalLink {
public length: number,
public tooltip?: string
) {
if (typeof startIndex !== 'number') {
if (typeof startIndex !== 'number' || startIndex < 0) {
throw illegalArgument('startIndex');
}
if (typeof length !== 'number') {
if (typeof length !== 'number' || length < 1) {
throw illegalArgument('length');
}
if (tooltip !== undefined && typeof tooltip !== 'string') {