diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-15 07:42:53 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-15 07:42:53 -0400 |
commit | 0217dc1125af1d52aaf0bcf2df626dd5fabc9ed3 (patch) | |
tree | 1eb4872290662651d312818acff130efc866264b /parser.c | |
parent | 2e7f7812abb7adf69198e698acad038523ff6d94 (diff) |
handle null parameter properly
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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;
|