Browse Source

fix undefined buttons

yogevbd 6 years ago
parent
commit
e3b4d15a06
1 changed files with 7 additions and 5 deletions
  1. 7
    5
      lib/src/commands/LayoutTreeCrawler.ts

+ 7
- 5
lib/src/commands/LayoutTreeCrawler.ts View File

@@ -63,7 +63,7 @@ export class LayoutTreeCrawler {
63 63
       this._normalizeButtons(passedOptions.topBar.leftButtons, (buttons, style) => {
64 64
         passedOptions.topBar.leftButtons = buttons;
65 65
 
66
-        if (staticOptions.topBar && buttons) {
66
+        if (staticOptions.topBar) {
67 67
           this._applyButtonsStyle(staticOptions.topBar.leftButtons, style);
68 68
         }
69 69
       });
@@ -71,7 +71,7 @@ export class LayoutTreeCrawler {
71 71
       this._normalizeButtons(passedOptions.topBar.rightButtons, (buttons, style) => {
72 72
         passedOptions.topBar.rightButtons = buttons;
73 73
 
74
-        if (staticOptions.topBar && buttons) {
74
+        if (staticOptions.topBar) {
75 75
           this._applyButtonsStyle(staticOptions.topBar.rightButtons, style);
76 76
         }
77 77
       });
@@ -87,9 +87,11 @@ export class LayoutTreeCrawler {
87 87
   }
88 88
 
89 89
   _applyButtonsStyle(buttons, style) {
90
-    buttons.forEach((button) => {
91
-      _.merge(button, style);
92
-    });
90
+    if (buttons) {
91
+      buttons.forEach((button) => {
92
+        _.merge(button, style);
93
+      });
94
+    }
93 95
   }
94 96
 
95 97
   _assertKnownLayoutType(type) {