Check TreeView node has children before getting length
Test: Make sure error in console no longer appears.
Change-Id: Ie54f1cba52be4cd0d3da0a6ba44401930c884c3b
diff --git a/tools/winscope/src/TreeView.vue b/tools/winscope/src/TreeView.vue
index 339887e..e5ae4a1 100644
--- a/tools/winscope/src/TreeView.vue
+++ b/tools/winscope/src/TreeView.vue
@@ -325,7 +325,7 @@
return this.$store.state.currentTimestamp;
},
isCollapsed() {
- if (this.item.children?.length === 0) {
+ if (!this.item.children || this.item.children?.length === 0) {
return false;
}
@@ -363,7 +363,7 @@
return this.applyingFlattened ? this.item.flattened : this.item.children;
},
isLeaf() {
- return !this.children || this.children?.length == 0;
+ return !this.children || this.children.length === 0;
},
isClickable() {
return !this.isLeaf || this.itemsClickable;