From a06135620205b6f872ef8e1d6e169370565b0386 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Wed, 25 Dec 2019 21:49:07 -0330 Subject: [PATCH] Fix potential divide by zero. --- src/gui/DialogContainer.hxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/DialogContainer.hxx b/src/gui/DialogContainer.hxx index 850859454..3cc175edd 100644 --- a/src/gui/DialogContainer.hxx +++ b/src/gui/DialogContainer.hxx @@ -156,11 +156,13 @@ class DialogContainer virtual Dialog* baseDialog() = 0; /** - Set input speeds + Set input speeds. */ static void setDoubleClickDelay(int delay) { _DOUBLE_CLICK_DELAY = delay; } static void setControllerDelay(int delay) { _REPEAT_INITIAL_DELAY = delay; } - static void setControllerRate(int rate) { _REPEAT_SUSTAIN_DELAY = 1000 / rate; } + static void setControllerRate(int rate) { + _REPEAT_SUSTAIN_DELAY = (rate > 0 ? (1000 / rate) : 50); + } private: void reset();