@@ -487,7 +487,8 @@ namespace Sass {
487
487
// upgrade string to number if possible (issue #948)
488
488
if (op_type == Sass_OP::DIV || op_type == Sass_OP::MUL) {
489
489
if (String_Constant* str = dynamic_cast <String_Constant*>(rhs)) {
490
- const char * start = str->value ().c_str ();
490
+ string value (str->value ());
491
+ const char * start = value.c_str ();
491
492
if (Prelexer::sequence < Prelexer::number >(start) != 0 ) {
492
493
rhs = new (ctx.mem ) Textual (rhs->pstate (), Textual::DIMENSION, str->value ());
493
494
rhs->is_delayed (false ); rhs = rhs->perform (this );
@@ -511,23 +512,23 @@ namespace Sass {
511
512
Expression::Concrete_Type r_type = rhs->concrete_type ();
512
513
513
514
if (l_type == Expression::NUMBER && r_type == Expression::NUMBER) {
514
- Number* l_n = static_cast <Number*>(lhs);
515
- Number* r_n = static_cast <Number*>(rhs);
515
+ Number* l_n = dynamic_cast <Number*>(lhs);
516
+ Number* r_n = dynamic_cast <Number*>(rhs);
516
517
return op_numbers (ctx, op_type, l_n, r_n);
517
518
}
518
519
if (l_type == Expression::NUMBER && r_type == Expression::COLOR) {
519
- Number* l_n = static_cast <Number*>(lhs);
520
- Color* r_c = static_cast <Color*>(rhs);
520
+ Number* l_n = dynamic_cast <Number*>(lhs);
521
+ Color* r_c = dynamic_cast <Color*>(rhs);
521
522
return op_number_color (ctx, op_type, l_n, r_c);
522
523
}
523
524
if (l_type == Expression::COLOR && r_type == Expression::NUMBER) {
524
- Color* l_c = static_cast <Color*>(lhs);
525
- Number* r_n = static_cast <Number*>(rhs);
525
+ Color* l_c = dynamic_cast <Color*>(lhs);
526
+ Number* r_n = dynamic_cast <Number*>(rhs);
526
527
return op_color_number (ctx, op_type, l_c, r_n);
527
528
}
528
529
if (l_type == Expression::COLOR && r_type == Expression::COLOR) {
529
- Color* l_c = static_cast <Color*>(lhs);
530
- Color* r_c = static_cast <Color*>(rhs);
530
+ Color* l_c = dynamic_cast <Color*>(lhs);
531
+ Color* r_c = dynamic_cast <Color*>(rhs);
531
532
return op_colors (ctx, op_type, l_c, r_c);
532
533
}
533
534
0 commit comments