diff --git a/py/vstr.c b/py/vstr.c index eb8e98729f..faf216d657 100644 --- a/py/vstr.c +++ b/py/vstr.c @@ -188,14 +188,13 @@ char *vstr_ins_blank_bytes(vstr_t *vstr, size_t byte_pos, size_t byte_len) { if (byte_pos > l) { byte_pos = l; } - if (byte_len > 0) { - // ensure room for the new bytes - vstr_ensure_extra(vstr, byte_len); - // copy up the string to make room for the new bytes - memmove(vstr->buf + byte_pos + byte_len, vstr->buf + byte_pos, l - byte_pos); - // increase the length - vstr->len += byte_len; - } + // ensure room for the new bytes + vstr_ensure_extra(vstr, byte_len); + // copy up the string to make room for the new bytes + memmove(vstr->buf + byte_pos + byte_len, vstr->buf + byte_pos, l - byte_pos); + // increase the length + vstr->len += byte_len; + // return a pointer to the location to insert new bytes at return vstr->buf + byte_pos; }