From: Mike Pall Date: Thu, 16 Oct 2025 11:13:51 +0000 (+0200) Subject: Fix io.write() of newly created buffer. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a69aef43fe1838da26c193d188580229b2387583;p=thirdparty%2FLuaJIT.git Fix io.write() of newly created buffer. Reported by vfprintf. #1386 --- diff --git a/src/lj_strfmt.c b/src/lj_strfmt.c index 04aebaa4..bb649fc8 100644 --- a/src/lj_strfmt.c +++ b/src/lj_strfmt.c @@ -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)) {