Fix io.write() of newly created buffer.

Reported by vfprintf. #1386
This commit is contained in:
Mike Pall
2025-10-16 13:13:51 +02:00
parent 54a162688e
commit a69aef43fe

View File

@@ -170,7 +170,7 @@ const char *lj_strfmt_wstrnum(lua_State *L, cTValue *o, MSize *lenp)
} else if (tvisbuf(o)) {
SBufExt *sbx = bufV(o);
*lenp = sbufxlen(sbx);
return sbx->r;
return sbx->r ? sbx->r : "";
} else if (tvisint(o)) {
sb = lj_strfmt_putint(lj_buf_tmp_(L), intV(o));
} else if (tvisnum(o)) {