diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-22 12:20:57 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-22 12:20:57 +0000 |
commit | 1750670084712e9b55aec73ed8c89a6ead773042 (patch) | |
tree | aef8e6ae13fc936f62a1ca9e98de04d9e3176651 /re.c | |
parent | 23cf2750d15f6a859d13d7110e5994b3575c6604 (diff) |
merge revision(s) 49675:
* re.c (match_aref): RMatch::regexp is Qnil after matching by a
string since r45451. [ruby-core:68209] [Bug #10877]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1787,7 +1787,7 @@ name_to_backref_error(VALUE name) static VALUE match_aref(int argc, VALUE *argv, VALUE match) { - VALUE idx, rest; + VALUE idx, rest, re; match_check(match); rb_scan_args(argc, argv, "11", &idx, &rest); @@ -1808,7 +1808,8 @@ match_aref(int argc, VALUE *argv, VALUE match) /* fall through */ case T_STRING: p = StringValuePtr(idx); - if (!rb_enc_compatible(RREGEXP(RMATCH(match)->regexp)->src, idx) || + re = RMATCH(match)->regexp; + if (NIL_P(re) || !rb_enc_compatible(RREGEXP(re)->src, idx) || (num = name_to_backref_number(RMATCH_REGS(match), RMATCH(match)->regexp, p, p + RSTRING_LEN(idx))) < 1) { name_to_backref_error(idx); |