diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-17 10:56:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-17 11:00:13 +0300 |
commit | 9134529b9eb9401470eb51d1cfc0d91a2ad2c109 (patch) | |
tree | 29b1c53a82620f8aeb3f813ee733dd9d6800dea6 | |
parent | d7204aed951a511c1549334b78dce0687afac74f (diff) |
UI: avoid int cast before clamping number input
Values outside int range would overflow.
-rw-r--r-- | source/blender/editors/interface/interface.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7ab4e1d9c35..427291e713a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -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; |