summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index e382b470c..c2526f354 100644
--- a/src/string.c
+++ b/src/string.c
@@ -2566,6 +2566,7 @@ mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len)
mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
}
if (capa <= total) {
+ if (capa == 0) capa = 1;
while (capa <= total) {
if (capa <= MRB_INT_MAX / 2) {
capa *= 2;