From b28de01270a663b3e89427a18816732c4d573c1d Mon Sep 17 00:00:00 2001 From: xzyfer Date: Sat, 7 Jan 2017 19:12:35 +1100 Subject: [PATCH] Fix segfault when comparing pseudo selectors Fixes #2289 Spec sass/sass-spec#1052 --- src/ast.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ast.cpp b/src/ast.cpp index c2b0b46a1e..726f0103c2 100644 --- a/src/ast.cpp +++ b/src/ast.cpp @@ -703,7 +703,12 @@ namespace Sass { bool Pseudo_Selector::operator< (const Pseudo_Selector& rhs) const { if (is_ns_eq(ns(), rhs.ns()) && name() == rhs.name()) - { return *(expression()) < *(rhs.expression()); } + { + String_Obj lhs_ex = expression(); + String_Obj rhs_ex = rhs.expression(); + if (rhs_ex && lhs_ex) return *lhs_ex < *rhs_ex; + else return lhs_ex < rhs_ex; + } if (is_ns_eq(ns(), rhs.ns())) { return name() < rhs.name(); } return ns() < rhs.ns();