Skip to content

Commit

Permalink
add fallback value
Browse files Browse the repository at this point in the history
  • Loading branch information
idleberg committed Jul 22, 2023
1 parent c2c8d8e commit 709ecd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export function getLineLength(line: number): number {
if (editorText && editorText.length) {
const lines: string[] = editorText.split('\n');

return lines[line].length;
return lines[line]?.length || 0;
}

return 0;
Expand Down

0 comments on commit 709ecd6

Please sign in to comment.