Skip to content

Commit e5421e6

Browse files
committed
Adjust output/error for modulo zero operation
Fixes #2593
1 parent b29e27d commit e5421e6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/operators.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ namespace Sass {
127127
double lval = lhs.value();
128128
double rval = rhs.value();
129129

130+
if (op == Sass_OP::MOD && rval == 0) {
131+
return SASS_MEMORY_NEW(String_Quoted, pstate, "NaN");
132+
}
133+
130134
if (op == Sass_OP::DIV && rval == 0) {
131135
std::string result(lval ? "Infinity" : "NaN");
132136
return SASS_MEMORY_NEW(String_Quoted, pstate, result);
133137
}
134138

135-
if (op == Sass_OP::MOD && rval == 0) {
136-
throw Exception::ZeroDivisionError(lhs, rhs);
137-
}
138-
139139
size_t l_n_units = lhs.numerators.size();
140140
size_t l_d_units = lhs.numerators.size();
141141
size_t r_n_units = rhs.denominators.size();

0 commit comments

Comments
 (0)