mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 19:42:56 +01:00
Fix potential NPE
This commit is contained in:
parent
bdd3de5f00
commit
f1754a3b26
1 changed files with 4 additions and 1 deletions
|
|
@ -104,7 +104,10 @@ export class DiagnosticsAdapter {
|
|||
.then((worker) => {
|
||||
return worker.doValidation(resource.toString()).then((diagnostics) => {
|
||||
const markers = diagnostics.map((d) => toDiagnostics(resource, d));
|
||||
editor.setModelMarkers(editor.getModel(resource), languageId, markers);
|
||||
const model = editor.getModel(resource);
|
||||
if (model && model.getModeId() === languageId) {
|
||||
editor.setModelMarkers(model, languageId, markers);
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(undefined, (err) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue