diff options
Diffstat (limited to 'source/helper.c')
-rw-r--r-- | source/helper.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/helper.c b/source/helper.c index 0d4e202d..df7d297a 100644 --- a/source/helper.c +++ b/source/helper.c @@ -1102,13 +1102,17 @@ char *helper_get_theme_path ( const char *file ) return filename; } -static void parse_pair ( char *input, rofi_range_pair *item ) +static gboolean parse_pair ( char *input, rofi_range_pair *item ) { // Skip leading blanks. while ( input != NULL && isblank ( *input ) ) { ++input; } + if ( input == NULL ) { + return FALSE; + } + const char *sep[] = { "-", ":" }; int pythonic = ( strchr ( input, ':' ) || input[0] == '-' ) ? 1 : 0; int index = 0; @@ -1130,6 +1134,7 @@ static void parse_pair ( char *input, rofi_range_pair *item ) --item->stop; } } + return TRUE; } void parse_ranges ( char *input, rofi_range_pair **list, unsigned int *length ) { @@ -1142,9 +1147,9 @@ void parse_ranges ( char *input, rofi_range_pair **list, unsigned int *length ) // Make space. *list = g_realloc ( ( *list ), ( ( *length ) + 1 ) * sizeof ( struct rofi_range_pair ) ); // Parse a single pair. - parse_pair ( token, &( ( *list )[*length] ) ); - - ( *length )++; + if ( parse_pair ( token, &( ( *list )[*length] ) ) ) { + ( *length )++; + } } } /** |