From dc54eef2c9f662d99b14a0c12e8c8c90a8c61252 Mon Sep 17 00:00:00 2001 From: Joshi Date: Tue, 24 Mar 2020 15:40:33 -0700 Subject: [PATCH] Resolves #2776 Adds null checks for telemetry and domain object configuration --- .../condition/criterion/TelemetryCriterion.js | 4 +++- .../displayLayout/components/TelemetryView.vue | 16 +++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/plugins/condition/criterion/TelemetryCriterion.js b/src/plugins/condition/criterion/TelemetryCriterion.js index bfe6954728..5332bbeefb 100644 --- a/src/plugins/condition/criterion/TelemetryCriterion.js +++ b/src/plugins/condition/criterion/TelemetryCriterion.js @@ -45,7 +45,9 @@ export default class TelemetryCriterion extends EventEmitter { this.input = telemetryDomainObjectDefinition.input; this.metadata = telemetryDomainObjectDefinition.metadata; this.telemetryObjectIdAsString = undefined; - this.objectAPI.get(this.objectAPI.makeKeyString(this.telemetry)).then((obj) => this.initialize(obj)); + if (this.telemetry) { + this.objectAPI.get(this.objectAPI.makeKeyString(this.telemetry)).then((obj) => this.initialize(obj)); + } } initialize(obj) { diff --git a/src/plugins/displayLayout/components/TelemetryView.vue b/src/plugins/displayLayout/components/TelemetryView.vue index 9f67577958..0a9ea7b856 100644 --- a/src/plugins/displayLayout/components/TelemetryView.vue +++ b/src/plugins/displayLayout/components/TelemetryView.vue @@ -268,15 +268,17 @@ export default { this.openmct.contextMenu._showContextMenuForObjectPath(this.currentObjectPath, event.x, event.y, CONTEXT_MENU_ACTIONS); }, initObjectStyles() { - this.styleRuleManager = new StyleRuleManager(this.domainObject.configuration.objectStyles, this.openmct, this.updateStyle.bind(this)); + if (this.domainObject.configuration) { + this.styleRuleManager = new StyleRuleManager(this.domainObject.configuration.objectStyles, this.openmct, this.updateStyle.bind(this)); - if (this.unlistenStyles) { - this.unlistenStyles(); + if (this.unlistenStyles) { + this.unlistenStyles(); + } + this.unlistenStyles = this.openmct.objects.observe(this.domainObject, 'configuration.objectStyles', (newObjectStyle) => { + //Updating object styles in the inspector view will trigger this so that the changes are reflected immediately + this.styleRuleManager.updateObjectStyleConfig(newObjectStyle); + }); } - this.unlistenStyles = this.openmct.objects.observe(this.domainObject, 'configuration.objectStyles', (newObjectStyle) => { - //Updating object styles in the inspector view will trigger this so that the changes are reflected immediately - this.styleRuleManager.updateObjectStyleConfig(newObjectStyle); - }); }, updateStyle(styleObj) { let keys = Object.keys(styleObj);