aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/re.c b/re.c
index 4340cf2982..2cc90ae312 100644
--- a/re.c
+++ b/re.c
@@ -1496,6 +1496,10 @@ rb_reg_match_pos(re, str, pos)
VALUE re, str;
long pos;
{
+ if (NIL_P(str)) {
+ rb_backref_set(Qnil);
+ return Qnil;
+ }
StringValue(str);
if (pos != 0) {
if (pos < 0) {