Made parsing text decoder output more reliable.

This commit is contained in:
Marat Fayzullin 2023-09-18 17:25:41 -04:00
parent 692be65f35
commit 984560ed5b
1 changed files with 2 additions and 4 deletions

View File

@ -760,7 +760,7 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
# If we know it's not pickled, let us not unpickle
if len(b) < 2 or b[0] != 0x80 or not 3 <= b[1] <= pickle.HIGHEST_PROTOCOL:
try:
callback(b.decode("ascii"))
callback(b.decode("ascii", errors="replace"))
except Exception as e:
logger.debug("Unpickler: %s" % e)
return
@ -772,9 +772,7 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
except EOFError:
pass
except pickle.UnpicklingError:
callback(b.decode("ascii"))
except ValueError:
pass
callback(b.decode("ascii", errors="replace"))
return unpickler