Skip to content

Commit 2dba175

Browse files
committed
Improve function call return value handling
Fix segfault caused by static cast and wrong type Fixes #1269
1 parent 6f2252b commit 2dba175

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

bind.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ namespace Sass {
142142
break;
143143
}
144144
// otherwise move one of the rest args into the param, converting to argument if necessary
145-
if (arglist->is_arglist()) {
146-
a = static_cast<Argument*>((*arglist)[0]);
147-
} else {
145+
if (!(a = dynamic_cast<Argument*>((*arglist)[0]))) {
148146
Expression* a_to_convert = (*arglist)[0];
149147
a = new (ctx.mem) Argument(a_to_convert->pstate(),
150148
a_to_convert,

eval.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,10 +703,8 @@ namespace Sass {
703703
if (result->pstate().file == string::npos)
704704
result->pstate(c->pstate());
705705

706-
do {
707-
result->is_delayed(result->concrete_type() == Expression::STRING);
708-
result = result->perform(this);
709-
} while (result->concrete_type() == Expression::NONE);
706+
result->is_delayed(result->concrete_type() == Expression::STRING);
707+
if (!result->is_delayed()) result = result->perform(this);
710708
return result;
711709
}
712710

0 commit comments

Comments
 (0)