]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix io.write() of newly created buffer.
authorMike Pall <mike>
Thu, 16 Oct 2025 11:13:51 +0000 (13:13 +0200)
committerMike Pall <mike>
Thu, 16 Oct 2025 11:13:51 +0000 (13:13 +0200)
Reported by vfprintf. #1386

src/lj_strfmt.c

index 04aebaa47251bc42e0884f4e2fc66cc0361a953e..bb649fc840fe565fd71979750641f0e50b691d39 100644 (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)) {