mirror of
https://github.com/danbulant/monaco-yaml
synced 2026-06-19 14:31:13 +00:00
Fix crashes from null model
This commit is contained in:
parent
8d278d3d19
commit
2bece31f56
1 changed files with 3 additions and 1 deletions
|
|
@ -62,7 +62,9 @@ export function createDiagnosticsAdapter(
|
|||
const diagnostics = await worker.doValidation(String(resource));
|
||||
const markers = diagnostics.map(toDiagnostics);
|
||||
const model = editor.getModel(resource);
|
||||
if (model.getModeId() === languageId) {
|
||||
// Return value from getModel can be null if model not found
|
||||
// (e.g. if user navigates away from editor)
|
||||
if (model && model.getModeId() === languageId) {
|
||||
editor.setModelMarkers(model, languageId, markers);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue