mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-09 23:39:50 +00:00
Fix empty strings crashing Namespace for float options
This feels like a Discord bug to me but it's causing issues
This commit is contained in:
parent
610edaeead
commit
c8db766be4
@ -142,7 +142,8 @@ class Namespace:
|
|||||||
self.__dict__[name] = value
|
self.__dict__[name] = value
|
||||||
elif opt_type == 10: # number
|
elif opt_type == 10: # number
|
||||||
value = option['value'] # type: ignore # Key is there
|
value = option['value'] # type: ignore # Key is there
|
||||||
if value is None:
|
# This condition is written this way because 0 can be a valid float
|
||||||
|
if value is None or value == '':
|
||||||
self.__dict__[name] = float('nan')
|
self.__dict__[name] = float('nan')
|
||||||
else:
|
else:
|
||||||
self.__dict__[name] = float(value)
|
self.__dict__[name] = float(value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user