summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-15 07:42:53 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-15 07:42:53 -0400
commit0217dc1125af1d52aaf0bcf2df626dd5fabc9ed3 (patch)
tree1eb4872290662651d312818acff130efc866264b /parser.c
parent2e7f7812abb7adf69198e698acad038523ff6d94 (diff)
handle null parameter properly
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c8
1 files 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(&parameter,&units);
- }
+ units_found = Parser_get_unit(&parameter,&units);
if (!error_num) {
command_type=(is_query<<2) | (parameter_found?2:0) | units_found;