summaryrefslogtreecommitdiff
path: root/fluid/Shortcut_Button.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2022-02-20 21:15:58 +0100
committerGitHub <noreply@github.com>2022-02-20 21:15:58 +0100
commita878e253adc900b2cac8abe1a1d8f17eb4555f75 (patch)
tree6c7ac1a2d315ebab6a9adc7bf7719b73c6399f9f /fluid/Shortcut_Button.cxx
parentfd8170525bb8e2555ac1902ab2d53a064aa9920b (diff)
Fluid: fixed missing return value (#398)
...and possible devision by zero
Diffstat (limited to 'fluid/Shortcut_Button.cxx')
-rw-r--r--fluid/Shortcut_Button.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/fluid/Shortcut_Button.cxx b/fluid/Shortcut_Button.cxx
index 07135c96b..fabe1ea11 100644
--- a/fluid/Shortcut_Button.cxx
+++ b/fluid/Shortcut_Button.cxx
@@ -272,7 +272,11 @@ int Fluid_Coord_Input::eval(uchar *&s, int prio) const {
} else if (c=='*' || c=='/') {
if (prio<=3) { s--; return v; }
if (c=='*') { v *= eval(s, 3); }
- else if (c=='/') { v /= eval(s, 3); }
+ else if (c=='/') {
+ int x = eval(s, 3);
+ if (x!=0) // if x is zero, don't divide
+ v /= x;
+ }
} else if (c==')') {
return v;
} else {