Skip to content

Commit bdadff7

Browse files
author
luoja
committed
move import platform
1 parent 7b0955b commit bdadff7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

can/interfaces/slcan.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from queue import Queue, Empty
1010
import threading
1111
from serial.tools import list_ports
12-
import platform
1312
from can import BusABC, CanProtocol, Message, typechecking
1413

1514
from ..exceptions import (
@@ -273,7 +272,7 @@ def _read_can(self) -> List[Message]:
273272
# Due to accessing `serialPortOrig.in_waiting` too often will reduce the performance.
274273
# We read the `serialPortOrig.in_waiting` only once here.
275274
in_waiting = self.serialPortOrig.in_waiting
276-
for _ in range(in_waiting):
275+
for _ in range(max(1, in_waiting)):
277276
new_byte = self.serialPortOrig.read(size=1)
278277
if new_byte:
279278
self._buffer.extend(new_byte)

0 commit comments

Comments
 (0)