Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/parse/mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ static css_error mq_parse_media_query(lwc_string **strings,
token = parserutils_vector_peek(vector, *ctx);
if (tokenIsChar(token, '(')) {
is_condition = true;
} else if (token->type == CSS_TOKEN_IDENT &&
} else if (token != NULL && token->type == CSS_TOKEN_IDENT &&
lwc_string_caseless_isequal(token->idata,
strings[NOT], &match) == lwc_error_ok &&
match) {
Expand Down
23 changes: 23 additions & 0 deletions test/data/parse2/mq.dat
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,26 @@
#expected
| @media 3ff
#reset

## A media list with trailing comma crashed css__mq_parse_media_list() loop

#data
@media),
#errors
#expected
| @media not 3ff
#reset

#data
@media ),,,
#errors
#expected
| @media not 3ff
#reset

#data
@media (color),
#errors
#expected
| @media 3ff
#reset