diff --git a/fitparse/records.py b/fitparse/records.py index b6603f5..9924e68 100644 --- a/fitparse/records.py +++ b/fitparse/records.py @@ -363,7 +363,10 @@ def parse_string(string): def add_dev_data_id(message): global DEV_TYPES dev_data_index = message.get('developer_data_index').raw_value - application_id = message.get('application_id').raw_value + if message.get('application_id'): + application_id = message.get('application_id').raw_value + else: + application_id = None # Note that nothing in the spec says overwriting an existing type is invalid DEV_TYPES[dev_data_index] = {'dev_data_index': dev_data_index, 'application_id': application_id, 'fields': {}} diff --git a/tests/files/elemnt-bolt-no-application-id-inside-developer-data-id.fit b/tests/files/elemnt-bolt-no-application-id-inside-developer-data-id.fit new file mode 100644 index 0000000..810004b Binary files /dev/null and b/tests/files/elemnt-bolt-no-application-id-inside-developer-data-id.fit differ diff --git a/tests/test.py b/tests/test.py index 45c41f2..8d36db7 100755 --- a/tests/test.py +++ b/tests/test.py @@ -409,6 +409,11 @@ def test_fileish_types(self): with FitFile(io.BytesIO(open(testfile("Settings.fit"), 'rb').read())): pass + def test_elemnt_bolt_developer_data_id_without_application_id(self): + """Test that a file without application id set inside developer_data_id is parsed + (as seen on ELEMNT BOLT with firmware version WB09-1507)""" + FitFile(testfile('elemnt-bolt-no-application-id-inside-developer-data-id.fit')).parse() + # TODO: # * Test Processors: # - process_type_<>, process_field_<>, process_units_<>, process_message_<>