Fix 16-bit range check in TMenuItem::action_edit (#14834)

2.0.x
Jason Smith 5 years ago committed by Scott Lahteine
parent 4af9908764
commit 534c105a7a

@ -191,8 +191,8 @@ class TMenuItem : MenuItemBase {
public: public:
static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=nullptr, const bool live=false) { static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=nullptr, const bool live=false) {
// Make sure minv and maxv fit within int16_t // Make sure minv and maxv fit within int16_t
const int32_t minv = _MAX(scale(minValue), INT_MIN), const int32_t minv = _MAX(scale(minValue), INT16_MIN),
maxv = _MIN(scale(maxValue), INT_MAX); maxv = _MIN(scale(maxValue), INT16_MAX);
init(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit, callback, live); init(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit, callback, live);
} }
static void edit() { MenuItemBase::edit(to_string, load); } static void edit() { MenuItemBase::edit(to_string, load); }

Loading…
Cancel
Save