summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 8615bf5a56..7416561e28 100644
--- a/string.c
+++ b/string.c
@@ -676,8 +676,8 @@ rb_str_resize(str, len)
rb_raise(rb_eArgError, "negative string size (or size too big)");
}
+ rb_str_modify(str);
if (len != RSTRING(str)->len) {
- rb_str_modify(str);
if (RSTRING(str)->len < len || RSTRING(str)->len - len > 1024) {
REALLOC_N(RSTRING(str)->ptr, char, len+1);
if (!FL_TEST(str, STR_NOCAPA)) {