Skip to content

Commit

Permalink
fix: Error on empty min/max call
Browse files Browse the repository at this point in the history
Closes #2914
  • Loading branch information
Unknown authored and Unknown committed Jun 28, 2019
1 parent c713140 commit f00094d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/fn_numbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ namespace Sass {
{
List* arglist = ARG("$numbers", List);
Number_Obj least;
for (size_t i = 0, L = arglist->length(); i < L; ++i) {
size_t L = arglist->length();
if (L == 0) {
error("At least one argument must be passed.", pstate, traces);
}
for (size_t i = 0; i < L; ++i) {
Expression_Obj val = arglist->value_at_index(i);
Number_Obj xi = Cast<Number>(val);
if (!xi) {
Expand All @@ -123,7 +127,11 @@ namespace Sass {
{
List* arglist = ARG("$numbers", List);
Number_Obj greatest;
for (size_t i = 0, L = arglist->length(); i < L; ++i) {
size_t L = arglist->length();
if (L == 0) {
error("At least one argument must be passed.", pstate, traces);
}
for (size_t i = 0; i < L; ++i) {
Expression_Obj val = arglist->value_at_index(i);
Number_Obj xi = Cast<Number>(val);
if (!xi) {
Expand Down

0 comments on commit f00094d

Please sign in to comment.