Skip to content

Commit 996dbb3

Browse files
authored
Merge pull request #2945 from nschonni/fix--Error-on-non-int-str-insert-index
fix: Error on non-int str-insert index
2 parents 2b8a17a + 1e23b4d commit 996dbb3

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)