Skip to content

Commit 280ffd8

Browse files
glebmxzyfer
authored andcommitted
Fix crash in selector-append('.x~~', 'a')
Fixes #2663
1 parent 2a4935c commit 280ffd8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/fn_selectors.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,13 @@ namespace Sass {
140140

141141
// TODO: Add check for namespace stuff
142142

143-
// append any selectors in childSeq's head
144-
parentSeqClone->mutable_last()->head()->concat(base->head());
145-
146-
// Set parentSeqClone new tail
147-
parentSeqClone->mutable_last()->tail( base->tail() );
143+
Complex_Selector_Ptr lastComponent = parentSeqClone->mutable_last();
144+
if (lastComponent->head() == nullptr) {
145+
std::string msg = "Parent \"" + parentSeqClone->to_string() + "\" is incompatible with \"" + base->to_string() + "\"";
146+
error(msg, pstate, traces);
147+
}
148+
lastComponent->head()->concat(base->head());
149+
lastComponent->tail(base->tail());
148150

149151
newElements.push_back(parentSeqClone);
150152
}

0 commit comments

Comments
 (0)