Ensure variables are defined when handling message from lint worker (#27561)

GitOrigin-RevId: 69e18c41707be360eb30657780915efb0d1c9aa7
This commit is contained in:
Alf Eaton
2025-08-06 12:07:27 +01:00
committed by Copybot
parent fe8e2e21fb
commit 8d1f12e6ea
@@ -35,10 +35,10 @@ const runLinter = () => {
})
}
lintWorker!.addEventListener('message', event => {
if (event.data) {
lintWorker.addEventListener('message', event => {
if (event.data && event.data.errors && currentView) {
const errors = event.data.errors as LintError[]
const editorState = currentView!.state
const editorState = currentView.state
const doc = editorState.doc
const cursorPosition = editorState.selection.main.head
const diagnostics = errorsToDiagnostics(errors, cursorPosition, doc.length)