summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorKenichi Kamiya <kachick1@gmail.com>2019-11-02 00:54:36 +0900
committerBenoit Daloze <eregontp@gmail.com>2019-11-03 11:03:04 +0100
commit452bee3ee8d68059fabd9b1c7a75661b14e3933e (patch)
treed0d6abd12e989242a1e70d2864682f39b7efde45 /re.c
parent772b0613c583773cd2eda23bce8275926a351e79 (diff)
Revert nil error and adding deprecation message
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2637
Diffstat (limited to 're.c')
-rw-r--r--re.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/re.c b/re.c
index e0878baf2c..6b8eda4df8 100644
--- a/re.c
+++ b/re.c
@@ -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) {