Skip to content

Commit e5fcf2c

Browse files
committed
fix(ui): guard shouldAutoTriggerSuggest against undefined line + auto-reformat multi-line edits
1 parent 2ce42fb commit e5fcf2c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎ui/src/core/page-components/agent-detail/modals/edit-control/json-editor-view.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,11 @@ function tryFormat(text: string): string | null {
144144

145145
/** Check if the cursor is at a position where auto-triggering suggestions is useful. */
146146
function shouldAutoTriggerSuggest(
147-
line: string,
147+
line: string | undefined,
148148
column: number,
149149
hasDomainSuggestions: () => boolean
150150
): boolean {
151+
if (!line) return false;
151152
const beforeCursor = line.substring(0, column - 1);
152153
const afterCursor = line.substring(column - 1);
153154

0 commit comments

Comments
 (0)