From 4c19df1ded597985c8e7f7ba2613481b2f7c3e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Thu, 26 Sep 2024 22:45:07 +0200 Subject: [PATCH] msg: print format string on format errors --- common/msg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/msg.c b/common/msg.c index 792d233892..cbb06e9e97 100644 --- a/common/msg.c +++ b/common/msg.c @@ -570,7 +570,10 @@ void mp_msg_va(struct mp_log *log, int lev, const char *format, va_list va) bstr_xappend(root, &root->buffer, log->partial[lev]); log->partial[lev].len = 0; - bstr_xappend_vasprintf(root, &root->buffer, format, va); + if (bstr_xappend_vasprintf(root, &root->buffer, format, va) < 0) { + bstr_xappend(root, &root->buffer, bstr0("format error: ")); + bstr_xappend(root, &root->buffer, bstr0(format)); + } // Remember last status message and restore it to ensure that it is // always displayed