Skip to content

Commit 3f5fde5

Browse files
committed
Merge pull request #1949 from xzyfer/fix/issue-1916
Fix segfault with non existing extend and parent selector
2 parents 986a502 + 748f097 commit 3f5fde5

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/ast.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,18 +1086,16 @@ namespace Sass {
10861086
Complex_Selector* Complex_Selector::first()
10871087
{
10881088
// declare variables used in loop
1089-
Complex_Selector* cur = this->tail_;
1090-
const Compound_Selector* head = head_;
1089+
Complex_Selector* cur = this;
1090+
const Compound_Selector* head;
10911091
// processing loop
10921092
while (cur)
10931093
{
10941094
// get the head
10951095
head = cur->head_;
1096-
// check for single parent ref
1097-
if (head && head->length() == 1)
1098-
{
1099-
// abort (and return) if it is not a parent selector
1100-
if (!dynamic_cast<Parent_Selector*>((*head)[0])) break;
1096+
// abort (and return) if it is not a parent selector
1097+
if (!head || head->length() != 1 || !dynamic_cast<Parent_Selector*>((*head)[0])) {
1098+
break;
11011099
}
11021100
// advance to next
11031101
cur = cur->tail_;

0 commit comments

Comments
 (0)