From 86c8146a56d57702a7e17eb8782bc63247d5db8e Mon Sep 17 00:00:00 2001 From: wellu Date: Fri, 20 Feb 2009 18:51:38 +0000 Subject: [PATCH] Limit the speed below 1000 units so that we don't get asserts. git-svn-id: file:///svnroot/speedometer/trunk@66 df364472-da61-43ef-8a67-511c89aa921b --- ui.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui.c b/ui.c index dc7e2c9..6c225ab 100644 --- 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: -- 1.7.9.5