Do not read index if no chunks in rosbag1
This commit is contained in:
parent
967328627c
commit
9830c38fc7
@ -357,7 +357,7 @@ class Reader:
|
|||||||
|
|
||||||
self.bio: Optional[BinaryIO] = None
|
self.bio: Optional[BinaryIO] = None
|
||||||
self.connections: list[Connection] = []
|
self.connections: list[Connection] = []
|
||||||
self.indexes: dict[int, list[IndexData]]
|
self.indexes: dict[int, list[IndexData]] = {}
|
||||||
self.index_data_header_offsets: Optional[tuple[int, int]] = None
|
self.index_data_header_offsets: Optional[tuple[int, int]] = None
|
||||||
self.chunk_infos: list[ChunkInfo] = []
|
self.chunk_infos: list[ChunkInfo] = []
|
||||||
self.chunks: dict[int, Chunk] = {}
|
self.chunks: dict[int, Chunk] = {}
|
||||||
@ -397,6 +397,9 @@ class Reader:
|
|||||||
if index_pos == 0:
|
if index_pos == 0:
|
||||||
raise ReaderError('Bag is not indexed, reindex before reading.')
|
raise ReaderError('Bag is not indexed, reindex before reading.')
|
||||||
|
|
||||||
|
if chunk_count == 0:
|
||||||
|
return
|
||||||
|
|
||||||
self.bio.seek(index_pos)
|
self.bio.seek(index_pos)
|
||||||
try:
|
try:
|
||||||
self.connections = [self.read_connection() for _ in range(conn_count)]
|
self.connections = [self.read_connection() for _ in range(conn_count)]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user