diff --git a/services/web/frontend/js/features/source-editor/utils/position.ts b/services/web/frontend/js/features/source-editor/utils/position.ts index da1f745a4c..fd966117b8 100644 --- a/services/web/frontend/js/features/source-editor/utils/position.ts +++ b/services/web/frontend/js/features/source-editor/utils/position.ts @@ -5,6 +5,10 @@ export const findValidPosition = ( lineNumber: number, // 1-indexed columnNumber = 0 // 0-indexed ): number => { + if (lineNumber < 1) { + return 0 + } + const lines = doc.lines if (lineNumber > lines) {