1
0
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:
Rapptz 2022-08-14 05:36:35 -04:00
parent 610edaeead
commit c8db766be4

@ -142,7 +142,8 @@ class Namespace:
self.__dict__[name] = value
elif opt_type == 10: # number
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')
else:
self.__dict__[name] = float(value)