diff --git a/src/app/playground/page.tsx b/src/app/playground/page.tsx index 506252b..ff002fe 100644 --- a/src/app/playground/page.tsx +++ b/src/app/playground/page.tsx @@ -117,15 +117,17 @@ export default function PlaygroundPage() { options={{ automaticLayout: true }} onMount={(editor) => { editorRef.current = editor; - const model = editorRef.current.getModel(); - if (model) { - const lineCount = model.getLineCount(); - const lastLineLength = model.getLineLength(lineCount); - editorRef.current.setPosition({ - lineNumber: lineCount, - column: lastLineLength + 1, - }); - editorRef.current.focus(); + if (editorRef.current) { + const model = editorRef.current.getModel(); + if (model) { + const lineCount = model.getLineCount(); + const lastLineLength = model.getLineLength(lineCount); + editorRef.current.setPosition({ + lineNumber: lineCount, + column: lastLineLength + 1, + }); + editorRef.current.focus(); + } } }} />