1 parent 0c980a6 commit c90b878Copy full SHA for c90b878
1 file changed
canopen/pdo/base.py
@@ -175,10 +175,12 @@ def __getitem__(self, key: int) -> PdoMap:
175
try:
176
return self.maps[key]
177
except KeyError:
178
- with contextlib.suppress(KeyError):
179
- return self.maps[key + 1 - self.map_offset]
180
181
- return self.maps[key + 1 - self.com_offset]
+ if self.map_offset:
+ with contextlib.suppress(KeyError):
+ return self.maps[key + 1 - self.map_offset]
+ if self.com_offset:
182
183
+ return self.maps[key + 1 - self.com_offset]
184
raise
185
186
def __iter__(self) -> Iterator[int]:
0 commit comments