Permalink
Browse files

mrb_string_value_cstr() should not raise error for frozen strings

  • Loading branch information...
matz committed Dec 1, 2015
1 parent 85bd997 commit 05411ee15e13d415fa385c534b155452668d052b
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/string.c
View
@@ -2182,6 +2182,10 @@ mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr)
char *p = RSTR_PTR(ps);
if (!p || p[len] != '\0') {
if (RSTR_FROZEN_P(ps)) {
*ptr = str = mrb_str_dup(mrb, str);
ps = mrb_str_ptr(str);
}
mrb_str_modify(mrb, ps);
return RSTR_PTR(ps);
}

0 comments on commit 05411ee

Please sign in to comment.