aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index b81e37ee0f..3b4065ac06 100644
--- a/parse.y
+++ b/parse.y
@@ -8170,7 +8170,7 @@ reg_compile_gen(struct parser_params* parser, VALUE str, int options)
compile_error(PARSER_ARG "%s", RSTRING_PTR(re));
return Qnil;
}
- rb_enc_copy(re, str);
+ if (str) rb_enc_copy(re, str);
return re;
}