Fix action_edit int range bug (#13737)
This commit is contained in:
parent
bf28ad4b6c
commit
836435c5ef
@ -182,8 +182,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=NULL, 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=NULL, const bool live=false) {
|
||||||
// Make sure minv and maxv fit within int16_t
|
// Make sure minv and maxv fit within int16_t
|
||||||
const int16_t minv = MAX(scale(minValue), INT_MIN),
|
const int16_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…
Reference in New Issue
Block a user