Browse Source

azuremonitor: guard for when switching from monaco editor

before it has fully loaded.
Daniel Lee 7 years ago
parent
commit
44c07eb2e9

+ 4 - 0
public/app/plugins/datasource/grafana-azure-monitor-datasource/monaco/kusto_code_editor.ts

@@ -103,6 +103,10 @@ export default class KustoCodeEditor {
 
       monaco.languages['kusto'].getKustoWorker().then(workerAccessor => {
         const model = this.codeEditor.getModel();
+        if (!model) {
+          return;
+        }
+
         workerAccessor(model.uri).then(worker => {
           const dbName = Object.keys(schema.Databases).length > 0 ? Object.keys(schema.Databases)[0] : '';
           worker.setSchemaFromShowSchema(schema, 'https://help.kusto.windows.net', dbName);