From 42ef1de6c1ae792e85d02337e405884d14306df8 Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Thu, 23 Mar 2017 10:40:22 -0700 Subject: [PATCH] Evaluate err.message only if err exists --- app/actions/device.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/actions/device.js b/app/actions/device.js index 62f3644c..65b79db5 100644 --- a/app/actions/device.js +++ b/app/actions/device.js @@ -54,7 +54,7 @@ const deviceActions = { payload: () => new Promise((resolve, reject) => { BluetoothService.getState((err, { state }) => { if (err || state !== bluetoothStates.ON) { - reject(new Error(err.message || 'Bluetooth is not enabled.')); + reject(new Error((err && err.message) || 'Bluetooth is not enabled.')); } else { Mixpanel.trackWithProperties('connectToDevice', { deviceIdentifier: identifier,