From a19a6edb7c464af9dd4303659ceabe2672882a6b Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 17 Dec 2014 08:06:44 +0900 Subject: mrb_str_new(mrb, "", len) creates an unmodifiable string object; ref #2674 --- src/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/string.c') diff --git a/src/string.c b/src/string.c index 23cd76747..1c54ffa72 100644 --- a/src/string.c +++ b/src/string.c @@ -163,7 +163,7 @@ str_new(mrb_state *mrb, const char *p, size_t len) { struct RString *s; - if (mrb_ro_data_p(p)) { + if (p && mrb_ro_data_p(p)) { return str_new_static(mrb, p, len); } s = mrb_obj_alloc_string(mrb); -- cgit v1.2.3