diff --git a/ee/tabby-ui/lib/utils/index.ts b/ee/tabby-ui/lib/utils/index.ts index 938068fe15a8..febf45bf59de 100644 --- a/ee/tabby-ui/lib/utils/index.ts +++ b/ee/tabby-ui/lib/utils/index.ts @@ -112,11 +112,11 @@ export function getRangeFromAttachmentCode(code: { startLine?: Maybe content: string }): LineRange | undefined { - if (!code?.startLine) return undefined + if (!code?.startLine || typeof code.startLine !== 'number') return undefined const start = code.startLine const lineCount = code.content.split('\n').length - const end = typeof start === 'number' ? start + lineCount - 1 : 0 + const end = start + lineCount - 1 return { start,