Merge pull request #255 from chehrlic/chris_max_throws_exception

RPI: don't throw exception when no valid frame was received
This commit is contained in:
Andreas Schiffler 2022-09-08 09:06:23 +02:00 committed by GitHub
commit 800e07e6fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -647,7 +647,7 @@ class InverterTransaction:
self.time_rx = end_frame.time_rx
tr_len = end_frame.seq - 0x80
except StopIteration:
seq_last = max(frames, key=lambda frame:frame.seq).seq
seq_last = max(frames, key=lambda frame:frame.seq).seq if len(frames) else 0
self.__retransmit_frame(seq_last + 1)
raise BufferError(f'Missing packet: Last packet {len(self.scratch)}')