Skip to content

Commit

Permalink
Fix segfault with non existing extend and parent selector
Browse files Browse the repository at this point in the history
Cherry-picked from #1925.

Fixes #1916
Spec sass/sass-spec#732
  • Loading branch information
mgreter authored and xzyfer committed Mar 17, 2016
1 parent 826827a commit 6c18db1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,18 +1085,16 @@ namespace Sass {
Complex_Selector* Complex_Selector::first()
{
// declare variables used in loop
Complex_Selector* cur = this->tail_;
const Compound_Selector* head = head_;
Complex_Selector* cur = this;
const Compound_Selector* head;
// processing loop
while (cur)
{
// get the head
head = cur->head_;
// check for single parent ref
if (head && head->length() == 1)
{
// abort (and return) if it is not a parent selector
if (!dynamic_cast<Parent_Selector*>((*head)[0])) break;
// abort (and return) if it is not a parent selector
if (!head || head->length() != 1 || !dynamic_cast<Parent_Selector*>((*head)[0])) {
break;
}
// advance to next
cur = cur->tail_;
Expand Down

0 comments on commit 6c18db1

Please sign in to comment.