mirror of
https://github.com/meshtastic/python.git
synced 2026-09-14 22:39:18 -04:00
fix empty string for bytes() params (fixes --setchan psk "")
This commit is contained in:
1 parent
0732ca8116
commit
c6f7b2cb3d
1 file changed
+3
-1
@@ -74,7 +74,9 @@ def fromStr(valstr):
|
||||
Args:
|
||||
valstr (string): A user provided string
|
||||
"""
|
||||
if(valstr.startswith('0x')):
|
||||
if(len(valstr) == 0): # Treat an emptystring as an empty bytes
|
||||
val = bytes()
|
||||
elif(valstr.startswith('0x')):
|
||||
# if needed convert to string with asBytes.decode('utf-8')
|
||||
val = bytes.fromhex(valstr[2:])
|
||||
elif valstr in trueTerms:
|
||||
|
||||
Reference in new issue
Block a user