summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/re.c b/re.c
index ff82636a46..de7ebeb41b 100644
--- a/re.c
+++ b/re.c
@@ -435,7 +435,9 @@ rb_reg_source(VALUE re)
static VALUE
rb_reg_inspect(VALUE re)
{
- rb_reg_check(re);
+ if (!RREGEXP(re)->ptr || !RREGEXP_SRC(re) || !RREGEXP_SRC_PTR(re)) {
+ return rb_any_to_s(re);
+ }
return rb_reg_desc(RREGEXP_SRC_PTR(re), RREGEXP_SRC_LEN(re), re);
}