Skip to content

Commit f8a06ff

Browse files
author
Aaron Leung
committed
fixing the selector lookahead to guard against missing/empty selectors
1 parent b29f50b commit f8a06ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

parser.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,7 @@ namespace Sass {
14691469
{
14701470
const char* p = start ? start : position;
14711471
const char* q;
1472+
bool saw_stuff = false;
14721473
bool saw_interpolant = false;
14731474

14741475
while ((q = peek< identifier >(p)) ||
@@ -1508,12 +1509,13 @@ namespace Sass {
15081509
(q = peek< sequence< exactly<'-'>, interpolant > >(p)) ||
15091510
(q = peek< sequence< pseudo_prefix, interpolant > >(p)) ||
15101511
(q = peek< interpolant >(p))) {
1512+
saw_stuff = true;
15111513
p = q;
15121514
if (*(p - 1) == '}') saw_interpolant = true;
15131515
}
15141516

15151517
Selector_Lookahead result;
1516-
result.found = peek< exactly<'{'> >(p) ? p : 0;
1518+
result.found = saw_stuff && peek< exactly<'{'> >(p) ? p : 0;
15171519
result.has_interpolants = saw_interpolant;
15181520

15191521
return result;

0 commit comments

Comments
 (0)