Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfault with non existing extend and parent selector #1949

Merged
merged 1 commit into from
Mar 17, 2016
Merged
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
12 changes: 5 additions & 7 deletions src/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,18 +1086,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