summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/array.c b/array.c
index 766d3044af..9cc0ac1815 100644
--- a/array.c
+++ b/array.c
@@ -86,6 +86,7 @@ rb_ary_new2(len)
ary->len = 0;
ary->capa = len;
ary->ptr = 0;
+ if (len == 0) len++;
ary->ptr = ALLOC_N(VALUE, len);
return (VALUE)ary;