From 9e1a6bd778f596449991a2ffa09928e9c61c49a7 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 19 Jan 2015 14:49:54 -0500 Subject: [PATCH] dynamic_cast nevers throws an exception when applied to pointers, only references (since it can't assign null to a reference). This patch removes the try/catch block and just checks the pointer for null, fixing a crasher here if the dynamic cast fails. --- parser.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/parser.cpp b/parser.cpp index c03abc8048..433d1a82ea 100644 --- a/parser.cpp +++ b/parser.cpp @@ -1056,12 +1056,8 @@ namespace Sass { // Special case: Ruby sass never tries to modulo if the lhs contains an interpolant if (peek< exactly<'%'> >(position) && fact1->concrete_type() == Expression::STRING) { - try { - String_Schema* ss = dynamic_cast(fact1); - if (ss->has_interpolants()) return fact1; - } - catch (bad_cast&) {} - catch (...) { throw; } + String_Schema* ss = dynamic_cast(fact1); + if (ss && ss->has_interpolants()) return fact1; } // if it's a singleton, return it directly; don't wrap it