osd/strconv.cpp: Deal with NUL when osd_uchar_from_osdchar uses mbstowcs.

This commit is contained in:
Vas Crabb 2025-01-08 04:22:23 +11:00
parent 9f33f0a2bd
commit 007948a96d

View File

@ -294,6 +294,14 @@ error:
int osd_uchar_from_osdchar(char32_t *uchar, const char *osdchar, size_t count)
{
// TODO: should this handle count == 0?
if (!*osdchar)
{
// mbstowcs stops on encountering NUL and doesn't include it in the output count
*uchar = char32_t(0);
return 1;
}
// FIXME: mbstowcs depends on global state
wchar_t wch;
count = mbstowcs(&wch, (char *)osdchar, 1);