From ed64a746043be3e1ea36255a6488568b3fb7cee0 Mon Sep 17 00:00:00 2001
From: Chris Schlaeger <chris@linux.com>
Date: Tue, 29 Aug 2017 21:48:21 +0200
Subject: Fix: Don't crash when BluetoothLE sensors were used.

---
 lib/postrunner/DataSources.rb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'lib')

diff --git a/lib/postrunner/DataSources.rb b/lib/postrunner/DataSources.rb
index 3db5547..29cd1e4 100644
--- a/lib/postrunner/DataSources.rb
+++ b/lib/postrunner/DataSources.rb
@@ -75,8 +75,12 @@ module PostRunner
     def device_name(index)
       @fit_activity.device_infos.each do |device|
         if device.device_index == index
-          return (DeviceList::DeviceTypeNames[device.device_type] ||
-                  device.device_type) + " [#{device.device_index}]"
+          if device.device_type
+            return (DeviceList::DeviceTypeNames[device.device_type] ||
+                    device.device_type) + " [#{device.device_index}]"
+          else
+            return "Unknown [#{device.device_index}]"
+          end
         end
       end
 
-- 
cgit v1.2.3