Skip to content

Commit 1e23b4d

Browse files
committed
fix: Error on non-int str-insert index
See sass/sass-spec#1439 Closes #2921
1 parent ac338df commit 1e23b4d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/fn_strings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ namespace Sass {
9999
String_Constant* i = ARG("$insert", String_Constant);
100100
std::string ins = i->value();
101101
double index = ARGVAL("$index");
102+
if (index != (int)index) {
103+
error("$index: " + std::to_string(index) + " is not an int", pstate, traces);
104+
}
102105
size_t len = UTF_8::code_point_count(str, 0, str.size());
103106

104107
if (index > 0 && index <= len) {

0 commit comments

Comments
 (0)