Skip to content

Commit ea936af

Browse files
committed
Don't crash on undecodable SSID's
1 parent 7453a4b commit ea936af

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

NetworkManager.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import struct
1414
import sys
1515
import time
16+
import warnings
1617
import weakref
1718
import xml.etree.ElementTree as etree
1819

@@ -605,7 +606,12 @@ def base_to_python(val):
605606

606607
@staticmethod
607608
def ssid_to_python(ssid):
608-
return bytes().join(ssid).decode('utf-8')
609+
try:
610+
return bytes().join(ssid).decode('utf-8')
611+
except UnicodeDecodeError:
612+
ssid = bytes().join(ssid).decode('utf-8', 'replace')
613+
warnings.warn("Unable to decode ssid %s properly" % ssid, UnicodeWarning)
614+
return ssid
609615

610616
@staticmethod
611617
def ssid_to_dbus(ssid):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy