Skip to content

Commit

Permalink
fix: Error on non-int str-insert index
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni committed Jul 18, 2019
1 parent ac338df commit 1e23b4d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/fn_strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ namespace Sass {
String_Constant* i = ARG("$insert", String_Constant);
std::string ins = i->value();
double index = ARGVAL("$index");
if (index != (int)index) {
error("$index: " + std::to_string(index) + " is not an int", pstate, traces);
}
size_t len = UTF_8::code_point_count(str, 0, str.size());

if (index > 0 && index <= len) {
Expand Down

0 comments on commit 1e23b4d

Please sign in to comment.