UI: avoid int cast before clamping number input

Values outside int range would overflow.
This commit is contained in:
Campbell Barton 2017-09-17 17:56:23 +10:00
parent d7204aed95
commit 9134529b9e

@ -2479,7 +2479,9 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
return false;
}
if (!ui_but_is_float(but)) value = (int)floor(value + 0.5);
if (!ui_but_is_float(but)) {
value = floor(value + 0.5);
}
/* not that we use hard limits here */
if (value < (double)but->hardmin) value = but->hardmin;