aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index af4fa6f8d7..583bc45bdd 100644
--- a/parse.y
+++ b/parse.y
@@ -8115,7 +8115,8 @@ reg_compile_gen(struct parser_params* parser, const char *ptr, long len, int opt
VALUE rb_reg_compile(const char *, long, int);
VALUE re = rb_reg_compile(ptr, len, (options) & ~RE_OPTION_ONCE);
- if (TYPE(re) == T_STRING) {
+ if (NIL_P(re)) {
+ RB_GC_GUARD(re) = rb_obj_as_string(rb_errinfo());
compile_error(PARSER_ARG "%s", RSTRING_PTR(re));
return Qnil;
}