diff options
author | Marius Kintel <marius@kintel.net> | 2013-02-02 18:28:00 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-02-02 18:28:00 (GMT) |
commit | 2eda86bf2f2540d4c9eda255c5fae58d71b5b31f (patch) | |
tree | 1550aa970487b20064bbae1eb2faf0f5ab32d295 /src/control.cc | |
parent | af0658a8fe441ebb0eb3d238e7055fd592343605 (diff) |
Fix bug assuming negative doubles will overflow a size_t, which failed on ARM. Related to #259
Diffstat (limited to 'src/control.cc')
-rw-r--r-- | src/control.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/control.cc b/src/control.cc index bdd0f40..44847f5 100644 --- a/src/control.cc +++ b/src/control.cc @@ -96,8 +96,10 @@ AbstractNode *ControlModule::evaluate(const Context*, const ModuleInstantiation size_t n = 0; if (inst->argvalues.size() > 0) { double v; - if (inst->argvalues[0].getDouble(v)) - n = v; + if (inst->argvalues[0].getDouble(v)) { + if (v < 0) return NULL; // Disallow negative child indices + n = trunc(v); + } } for (int i = Context::ctx_stack.size()-1; i >= 0; i--) { const Context *c = Context::ctx_stack[i]; |