summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
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;