fix: Move lines=[] above lock in _read_cb() (Issue #683)
UnboundLocalError when _ser is None — lines was only assigned inside the else branch. Move initialisation to function scope so the for-loop outside the lock always has a valid list. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5e82878083
commit
05ba557dca
@ -154,12 +154,12 @@ class SaltybotCmdNode(Node):
|
||||
# ── RX — telemetry read ───────────────────────────────────────────────────
|
||||
|
||||
def _read_cb(self):
|
||||
lines = []
|
||||
with self._ser_lock:
|
||||
if self._ser is None or not self._ser.is_open:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
lines = []
|
||||
while self._ser.in_waiting:
|
||||
raw = self._ser.readline()
|
||||
if raw:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user