summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-12-17 08:06:44 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-12-17 08:06:44 +0900
commita19a6edb7c464af9dd4303659ceabe2672882a6b (patch)
treef1a79ab32b9ab40fadd6c967ff60dc886911ed28 /src
parent0c4d053a94613926a5f4bc4d5b6370aee5eec78a (diff)
downloadmruby-a19a6edb7c464af9dd4303659ceabe2672882a6b.tar.gz
mruby-a19a6edb7c464af9dd4303659ceabe2672882a6b.zip
mrb_str_new(mrb, "", len) creates an unmodifiable string object; ref #2674
Diffstat (limited to 'src')
-rw-r--r--src/string.c2
1 files changed, 1 insertions, 1 deletions
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);