From 5e70adb5110f731a4c8e17ecaad116aad9bb18b7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 Mar 2017 11:22:08 -0700 Subject: [PATCH] Guard against only specifying select or highlight handler --- lib/browser/api/touch-bar.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/browser/api/touch-bar.js b/lib/browser/api/touch-bar.js index 7f997edde87c..62b3e2195b58 100644 --- a/lib/browser/api/touch-bar.js +++ b/lib/browser/api/touch-bar.js @@ -235,11 +235,14 @@ TouchBar.TouchBarScrubber = class TouchBarScrubber extends TouchBarItem { constructor (config) { super() if (config == null) config = {} - const {items, onSelect, onHighlight} = config + const {items} = config + let {onSelect, onHighlight} = config this.type = 'scrubber' this._addLiveProperty('items', items) if (typeof onSelect === 'function' || typeof onHighlight === 'function') { + if (onSelect == null) onSelect = () => {} + if (onHighlight == null) onHighlight = () => {} this.onInteraction = (details) => { if (details.type === 'select') { onSelect(details.selectedIndex)