forked from bartvdbraak/blender
Fix T47477: Transform allows 'inf' input
Numeric input wasn't checking numbers were finite, could crash transforming with skin modifier.
This commit is contained in:
parent
60e53e0ce6
commit
1d15421af9
@ -477,6 +477,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
|
||||
|
||||
/* At this point, our value has changed, try to interpret it with python (if str is not empty!). */
|
||||
if (n->str[0]) {
|
||||
const float val_prev = n->val[idx];
|
||||
#ifdef WITH_PYTHON
|
||||
Scene *sce = CTX_data_scene(C);
|
||||
double val;
|
||||
@ -514,6 +515,11 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
|
||||
if (n->val_flag[idx] & NUM_INVERSE) {
|
||||
n->val[idx] = 1.0f / n->val[idx];
|
||||
}
|
||||
|
||||
if (UNLIKELY(!isfinite(n->val[idx]))) {
|
||||
n->val[idx] = val_prev;
|
||||
n->val_flag[idx] |= NUM_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
/* REDRAW SINCE NUMBERS HAVE CHANGED */
|
||||
|
Loading…
Reference in New Issue
Block a user