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
Notes: blender-bot 2023-04-19 22:54:54 +02:00
Referenced by issue #53683, 2.79a release
1 changed files with 3 additions and 1 deletions

View File

@ -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;