Просмотр исходного кода

Restore null check in get_status_response()

Prevents crash when called without active connection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tuanchris 1 неделя назад
Родитель
Сommit
2f29ac10ed
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      modules/connection/connection_manager.py

+ 4 - 0
modules/connection/connection_manager.py

@@ -391,6 +391,10 @@ def get_status_response() -> str:
     """
     Send a status query ('?') and return the response if available.
     """
+    if state.conn is None or not state.conn.is_connected():
+        logger.warning("Cannot get status response: no active connection")
+        return False
+
     while True:
         try:
             state.conn.send('?')