diff --git a/src/ast_selectors.cpp b/src/ast_selectors.cpp index 3327350ac..98cfd5c92 100644 --- a/src/ast_selectors.cpp +++ b/src/ast_selectors.cpp @@ -88,7 +88,9 @@ namespace Sass { bool Selector_Schema::has_parent_ref() const { if (String_Schema_Obj schema = Cast(contents())) { - return !schema->empty() && typeid(*schema->at(0)) == typeid(Parent_Selector); + if (schema->empty()) return false; + const auto& first = *schema->at(0); + return typeid(first) == typeid(Parent_Selector); } return false; } @@ -96,7 +98,9 @@ namespace Sass { bool Selector_Schema::has_real_parent_ref() const { if (String_Schema_Obj schema = Cast(contents())) { - return !schema->empty() && typeid(*schema->at(0)) == typeid(Parent_Reference); + if (schema->empty()) return false; + const auto& first = *schema->at(0); + return typeid(first) == typeid(Parent_Reference); } return false; }