Skip to content

Commit

Permalink
dynamic_cast nevers throws an exception when applied to pointers, onl…
Browse files Browse the repository at this point in the history
…y 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.
  • Loading branch information
mmaxim committed Jan 19, 2015
1 parent b75de0f commit 9e1a6bd
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions parser.cpp
Expand Up @@ -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<String_Schema*>(fact1);
if (ss->has_interpolants()) return fact1;
}
catch (bad_cast&) {}
catch (...) { throw; }
String_Schema* ss = dynamic_cast<String_Schema*>(fact1);
if (ss && ss->has_interpolants()) return fact1;
}

// if it's a singleton, return it directly; don't wrap it
Expand Down

0 comments on commit 9e1a6bd

Please sign in to comment.