mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 11:36:24 +01:00
[MIRROR] Fixes numeric prefs not working with TGUI dropdowns that might return a string instead of a number [MDB IGNORE] (#9317)
* Fixes numeric prefs not working with TGUI dropdowns that might return a string instead of a number (#62653) * Fixes numeric prefs not working with TGUI dropdowns that might return a string instead of a number Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
@@ -498,6 +498,8 @@ GLOBAL_LIST_INIT(preference_entries_by_key, init_preference_entries_by_key())
|
||||
abstract_type = /datum/preference/numeric
|
||||
|
||||
/datum/preference/numeric/deserialize(input, datum/preferences/preferences)
|
||||
if(istext(input)) // Sometimes TGUI will return a string instead of a number, so we take that into account.
|
||||
input = text2num(input) // Worst case, it's null, it'll just use create_default_value()
|
||||
return sanitize_float(input, minimum, maximum, step, create_default_value())
|
||||
|
||||
/datum/preference/numeric/serialize(input)
|
||||
|
||||
Reference in New Issue
Block a user