From 0217dc1125af1d52aaf0bcf2df626dd5fabc9ed3 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Wed, 15 Aug 2012 07:42:53 -0400 Subject: handle null parameter properly --- parser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/parser.c b/parser.c index 44a8ec3..d1e2c44 100644 --- a/parser.c +++ b/parser.c @@ -471,6 +471,10 @@ static int Parser_get_unit(char **parameter, char **units) /* this function takes a parameter like "1e+6 ms" and breaks it into parameter="1e+6" and units="ms" */ + if (*parameter == NULL) { + *parameter = g_strdup (""); + } + g_assert (*units == NULL); gchar *end_ptr; @@ -647,9 +651,7 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer int error_num=OK; - if (parameter_found) { - units_found = Parser_get_unit(¶meter,&units); - } + units_found = Parser_get_unit(¶meter,&units); if (!error_num) { command_type=(is_query<<2) | (parameter_found?2:0) | units_found; -- cgit