From c10e5e918f8cc438221038d3fbb6a8d4195c67d8 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Thu, 2 May 2019 12:23:53 +0200 Subject: [PATCH] tab closing fix --- terminus-core/src/services/touchbar.service.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/terminus-core/src/services/touchbar.service.ts b/terminus-core/src/services/touchbar.service.ts index 706b82d0..1eda0d7c 100644 --- a/terminus-core/src/services/touchbar.service.ts +++ b/terminus-core/src/services/touchbar.service.ts @@ -32,12 +32,18 @@ export class TouchbarService { let activityIcon = this.electron.nativeImage.createFromPath(activityIconPath) app.tabOpened$.subscribe(tab => { tab.titleChange$.subscribe(title => { - this.tabSegments[app.tabs.indexOf(tab)].label = this.shortenTitle(title) - this.tabsSegmentedControl.segments = this.tabSegments + let segment = this.tabSegments[app.tabs.indexOf(tab)] + if (segment) { + segment.label = this.shortenTitle(title) + this.tabsSegmentedControl.segments = this.tabSegments + } }) tab.activity$.subscribe(hasActivity => { let showIcon = this.app.activeTab !== tab && hasActivity - this.tabSegments[app.tabs.indexOf(tab)].icon = showIcon ? activityIcon : null + let segment = this.tabSegments[app.tabs.indexOf(tab)] + if (segment) { + segment.icon = showIcon ? activityIcon : null + } }) }) }