Skip to content

Commit

Permalink
Merge pull request sass#2945 from nschonni/fix--Error-on-non-int-str-…
Browse files Browse the repository at this point in the history
…insert-index

fix: Error on non-int str-insert index
  • Loading branch information
nschonni authored Jul 26, 2019
2 parents 2b8a17a + 1e23b4d commit 996dbb3
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 996dbb3

Please sign in to comment.