Skip to content

Commit

Permalink
usbmux: fix handling of bad messages (#1208)
Browse files Browse the repository at this point in the history
Close #1208
  • Loading branch information
doronz88 committed Sep 22, 2024
1 parent 1ab62ef commit b9e5255
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pymobiledevice3/usbmux.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,11 @@ def get_device_list(self, timeout: float = None) -> None:
""" get device list synchronously without waiting the timeout """
self.devices = []
self._send({'MessageType': 'ListDevices'})
for response in self._receive(self._tag - 1)['DeviceList']:
response = self._receive(self._tag - 1)
device_list = response.get('DeviceList')
if device_list is None:
raise MuxException(f'Got an invalid response from usbmux: {response}')
for response in device_list:
if response['MessageType'] == 'Attached':
super()._add_device(MuxDevice(response['DeviceID'], response['Properties']['SerialNumber'],
response['Properties']['ConnectionType']))
Expand Down

0 comments on commit b9e5255

Please sign in to comment.