Merge pull request #3483 from ksss/string-index

String#index shouldn't return nil when "".index ""
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-03-05 20:27:28 +09:00
committed by GitHub
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -1608,7 +1608,7 @@ mrb_str_index(mrb_state *mrb, mrb_value str)
return mrb_nil_value();
}
}
if (pos >= clen) return mrb_nil_value();
if (pos > clen) return mrb_nil_value();
pos = chars2bytes(str, 0, pos);
switch (mrb_type(sub)) {