Limit the speed below 1000 units so that we don't get asserts.
authorwellu <wellu@wellu.org>
Fri, 20 Feb 2009 18:51:38 +0000 (18:51 +0000)
committerwellu <wellu@wellu.org>
Fri, 20 Feb 2009 18:51:38 +0000 (18:51 +0000)
git-svn-id: file:///svnroot/speedometer/trunk@66 df364472-da61-43ef-8a67-511c89aa921b

ui.c

diff --git a/ui.c b/ui.c
index dc7e2c9..6c225ab 100644 (file)
--- a/ui.c
+++ b/ui.c
@@ -219,6 +219,15 @@ void interpret_and_set_speed(gdouble speed) {
         */
        speed *= conversion[unit];
 
+       /* we need to limit the speed down to
+        * less than 1000 whatever or else hell
+        * breaks loose in the form of assert
+        */
+       if(!(fabs(speed) < 1000)) {
+           g_print("Ahem, may I suggest to limit the speed (%f) a bit, Sir.\n", speed);
+           speed = 0;
+       }
+
        /* Convert float to a 6 digits (including dot) wide
         * string with leading zeros. After conversion
         * the speed looks like: