Skip to content

Conversation

@bdraco
Copy link
Contributor

@bdraco bdraco commented Jan 23, 2025

Action may be an empty list. This causes an uncaught thread exception

025-01-23 09:11:18.656 ERROR (Thread-15) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/Users/bdraco/home-assistant/venv/lib/python3.13/site-packages/wsdiscovery/threaded.py", line 151, in run
    self._recvMessages()
    ~~~~~~~~~~~~~~~~~~^^
  File "/Users/bdraco/home-assistant/venv/lib/python3.13/site-packages/wsdiscovery/threaded.py", line 162, in _recvMessages
    env = parseSOAPMessage(data, addr[0])
  File "/Users/bdraco/home-assistant/venv/lib/python3.13/site-packages/wsdiscovery/message.py", line 39, in parseSOAPMessage
    soapAction = dom.getElementsByTagNameNS(NS_ADDRESSING, "Action")[0].firstChild.data.strip()
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

bdraco added a commit to bdraco/python-ws-discovery that referenced this pull request Jan 23, 2025
If a single message cannot be parsed and throws, the whole
thread would collapse and no more messages would be parsed
see exception in andreikop#82
@bdraco bdraco requested a review from andreikop January 24, 2025 08:19
@andreikop andreikop merged commit 46d4cee into andreikop:master Jan 24, 2025
5 checks passed
@bdraco bdraco deleted the no_action branch January 24, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants