msg: return zero length if bstr_split_utf8 fails

In theory bstr_split_utf8 should skip invalid sequence and move further,
but it doesn't do that currently, so just the string if unsuported code if
found.

Fixes infinite loop on code.len == 0 condition.

Fixes: 5864b72d1a
This commit is contained in:
Kacper Michajłow 2024-01-04 21:02:17 +01:00 committed by sfan5
parent 41259db952
commit 485221ba22
1 changed files with 1 additions and 1 deletions

View File

@ -350,7 +350,7 @@ static int term_disp_width(bstr str)
bstr code = bstr_split_utf8(str, &str);
if (code.len == 0)
continue;
return 0;
if (code.len == 1 && *code.start == '\n')
continue;