Skip to content

Commit b41af1b

Browse files
authored
Fix crash with no time mapping. (#375)
2 parents feacc8f + f50f5ff commit b41af1b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

python/fusion_engine_client/parsers/file_index.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,11 @@ def __init__(self, fe_index: FileIndex, time_mapping_path: str) -> None:
585585

586586
@classmethod
587587
def from_data_path(cls, fe_index: FileIndex, data_path: str) -> Optional['HostTimeIndexMap']:
588-
return cls(fe_index, data_path + TIMESTAMP_FILE_ENDING)
588+
time_mapping_path = data_path + TIMESTAMP_FILE_ENDING
589+
if os.path.exists(time_mapping_path):
590+
return cls(fe_index, time_mapping_path)
591+
else:
592+
return None
589593

590594
def get_host_timestamps(self, fe_index_msg_indexes: Sequence[int]) -> NDArray[np.datetime64]:
591595
return self.time_map_data['posix_time'][self.message_mappings[fe_index_msg_indexes]]

0 commit comments

Comments
 (0)