summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/string.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c
index 0a28f2565..9a1a6fba1 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1985,7 +1985,8 @@ bad:
MRB_API const char*
mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr)
{
- struct RString *ps = mrb_str_ptr(*ptr);
+ mrb_value str = mrb_str_to_str(mrb, *ptr);
+ struct RString *ps = mrb_str_ptr(str);
mrb_int len = mrb_str_strlen(mrb, ps);
char *p = RSTR_PTR(ps);