From 174e419314ab06186579a0b5e9324ec97622b2b0 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Mon, 9 Jan 2012 15:52:15 +0000 Subject: [PATCH] - fixed keyboard bug where - was thought to be numeric --- source/shared_lib/sources/util/conversion.cpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/source/shared_lib/sources/util/conversion.cpp b/source/shared_lib/sources/util/conversion.cpp index c75497e45..a2704c1c5 100644 --- a/source/shared_lib/sources/util/conversion.cpp +++ b/source/shared_lib/sources/util/conversion.cpp @@ -136,16 +136,19 @@ string doubleToStr(double d,int precsion) { } bool IsNumeric(const char *p, bool allowNegative) { - int index = 0; - for ( ; *p; p++) { - if (*p < '0' || *p > '9') { - if(allowNegative == false || (*p != '-' && index == 0)) { - return false; - } + if(p != NULL && strcmp(p,"-") == 0) { + return false; + } + int index = 0; + for ( ; *p; p++) { + if (*p < '0' || *p > '9') { + if(allowNegative == false || (*p != '-' && index == 0)) { + return false; + } + } + index++; } - index++; - } - return true; + return true; } class Comma: public numpunct// own facet class