From 76829ad2520e8ebbc6a67d8d5f7b33f38f5e1719 Mon Sep 17 00:00:00 2001 From: Shefali Joshi Date: Fri, 7 Jan 2022 08:57:10 -0800 Subject: [PATCH] Check for ref when trying to get the style receiver. (#4687) Also ensure that the property being displayed in Properties is actually a part of the domainObject. --- src/ui/components/ObjectView.vue | 12 ++++++++---- src/ui/inspector/details/Properties.vue | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ui/components/ObjectView.vue b/src/ui/components/ObjectView.vue index 50420c2bc1..38111dc397 100644 --- a/src/ui/components/ObjectView.vue +++ b/src/ui/components/ObjectView.vue @@ -141,11 +141,15 @@ export default { this.openmct.objectViews.off('clearData', this.clearData); }, getStyleReceiver() { - let styleReceiver = this.$refs.objectViewWrapper.querySelector('.js-style-receiver') - || this.$refs.objectViewWrapper.querySelector(':first-child'); + let styleReceiver; - if (styleReceiver === null) { - styleReceiver = undefined; + if (this.$refs.objectViewWrapper !== undefined) { + styleReceiver = this.$refs.objectViewWrapper.querySelector('.js-style-receiver') + || this.$refs.objectViewWrapper.querySelector(':first-child'); + + if (styleReceiver === null) { + styleReceiver = undefined; + } } return styleReceiver; diff --git a/src/ui/inspector/details/Properties.vue b/src/ui/inspector/details/Properties.vue index ded3769ebd..2e2079ba7a 100644 --- a/src/ui/inspector/details/Properties.vue +++ b/src/ui/inspector/details/Properties.vue @@ -186,6 +186,10 @@ export default { return { name: field.name, value: field.path.reduce((object, key) => { + if (object === undefined) { + return object; + } + return object[key]; }, this.domainObject) };