diff options
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -3323,7 +3323,9 @@ rb_reg_match_m(int argc, VALUE *argv, VALUE re) pos = 0; } - str = SYMBOL_P(str) ? rb_sym2str(str) : StringValue(str); + if (NIL_P(str)) { + rb_warn("given argument is nil"); + } pos = reg_match_pos(re, &str, pos); if (pos < 0) { rb_backref_set(Qnil); @@ -3369,6 +3371,10 @@ rb_reg_match_p(VALUE re, VALUE str, long pos) const UChar *start, *end; int tmpreg; + if (NIL_P(str)) { + rb_warn("given argument is nil"); + return Qfalse; + } str = SYMBOL_P(str) ? rb_sym2str(str) : StringValue(str); if (pos) { if (pos < 0) { |