msg: print format string on format errors

This commit is contained in:
Kacper Michajłow 2024-09-26 22:45:07 +02:00 committed by sfan5
parent 96006fa97b
commit 4c19df1ded
1 changed files with 4 additions and 1 deletions

View File

@ -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