diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-05 20:27:28 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-03-05 20:27:28 +0900 |
| commit | d050694580e99bc5699da36640d8ce2b4e93c5d0 (patch) | |
| tree | 019001f5d1a3a0185f0f14886f169fbc7e7c9763 /src | |
| parent | 4f43db862a19df01720f72cc91925a497c7d7f45 (diff) | |
| parent | 76e10351faa20301f73a333b13f94a41059baf14 (diff) | |
| download | mruby-d050694580e99bc5699da36640d8ce2b4e93c5d0.tar.gz mruby-d050694580e99bc5699da36640d8ce2b4e93c5d0.zip | |
Merge pull request #3483 from ksss/string-index
String#index shouldn't return nil when "".index ""
Diffstat (limited to 'src')
| -rw-r--r-- | src/string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c index 9efc89b34..c36b7524a 100644 --- a/src/string.c +++ b/src/string.c @@ -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)) { |
