From 8d1f12e6ea65a4ed6c1808f08f67c86136568aa0 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Wed, 6 Aug 2025 12:07:27 +0100 Subject: [PATCH] Ensure variables are defined when handling message from lint worker (#27561) GitOrigin-RevId: 69e18c41707be360eb30657780915efb0d1c9aa7 --- .../source-editor/languages/latex/linter/latex-linter.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/languages/latex/linter/latex-linter.ts b/services/web/frontend/js/features/source-editor/languages/latex/linter/latex-linter.ts index fefd4f0e73..2cdfb387b5 100644 --- a/services/web/frontend/js/features/source-editor/languages/latex/linter/latex-linter.ts +++ b/services/web/frontend/js/features/source-editor/languages/latex/linter/latex-linter.ts @@ -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)