Skip to content

Commit 0e6b4a2

Browse files
committed
Merge pull request #1266 from xzyfer/fix/segfault-number-functions
Fix segfault in mix and max functions
2 parents dc9f2e2 + b057494 commit 0e6b4a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

functions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,8 @@ namespace Sass {
10511051
Number* least = 0;
10521052
for (size_t i = 0, L = arglist->length(); i < L; ++i) {
10531053
Number* xi = dynamic_cast<Number*>(arglist->value_at_index(i));
1054+
if (!xi) error("`" + string(sig) + "` only takes numeric arguments", pstate);
10541055
if (least) {
1055-
if (!xi) error("`" + string(sig) + "` only takes numeric arguments", pstate);
10561056
if (lt(xi, least, ctx)) least = xi;
10571057
} else least = xi;
10581058
}
@@ -1066,8 +1066,8 @@ namespace Sass {
10661066
Number* greatest = 0;
10671067
for (size_t i = 0, L = arglist->length(); i < L; ++i) {
10681068
Number* xi = dynamic_cast<Number*>(arglist->value_at_index(i));
1069+
if (!xi) error("`" + string(sig) + "` only takes numeric arguments", pstate);
10691070
if (greatest) {
1070-
if (!xi) error("`" + string(sig) + "` only takes numeric arguments", pstate);
10711071
if (lt(greatest, xi, ctx)) greatest = xi;
10721072
} else greatest = xi;
10731073
}

0 commit comments

Comments
 (0)