summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fluid/Fl_Widget_Type.cxx4
-rw-r--r--fluid/Shortcut_Button.cxx6
2 files changed, 9 insertions, 1 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index 0b523ccca..f93ff2c3f 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -513,24 +513,28 @@ static int vars_x_cb(const Fluid_Coord_Input*, void *v) {
Fl_Type *t = (Fl_Type*)v;
if (t->is_widget())
return ((Fl_Widget_Type*)t)->o->x();
+ return 0;
}
static int vars_y_cb(const Fluid_Coord_Input*, void *v) {
Fl_Type *t = (Fl_Type*)v;
if (t->is_widget())
return ((Fl_Widget_Type*)t)->o->y();
+ return 0;
}
static int vars_w_cb(const Fluid_Coord_Input*, void *v) {
Fl_Type *t = (Fl_Type*)v;
if (t->is_widget())
return ((Fl_Widget_Type*)t)->o->w();
+ return 0;
}
static int vars_h_cb(const Fluid_Coord_Input*, void *v) {
Fl_Type *t = (Fl_Type*)v;
if (t->is_widget())
return ((Fl_Widget_Type*)t)->o->h();
+ return 0;
}
static int vars_px_cb(const Fluid_Coord_Input*, void *v) {
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 {