1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00

Add check for input == NULL.

This commit is contained in:
Dave Davenport 2021-01-17 16:09:58 +01:00 committed by Dave Davenport
parent 95fb3dacb9
commit f1b32e87f7

View file

@ -1138,13 +1138,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;
@ -1166,6 +1170,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 )
{
@ -1178,9 +1183,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 )++;
}
}
}
/**