From 4d22f1dedd45d075f42335fe12af195e24cf3b41 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 26 Feb 2022 14:55:49 +0000 Subject: [PATCH] Make buf_append_utf16le() robust against being passed NULL This should stop the crash in #370 slthough it would be good to know precisely why it's happening. Signed-off-by: David Woodhouse --- textbuf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/textbuf.c b/textbuf.c index 760d3602..dafea6c8 100644 --- a/textbuf.c +++ b/textbuf.c @@ -287,6 +287,9 @@ int buf_append_utf16le(struct oc_text_buf *buf, const char *utf8) { int utfchar, len = 0; + if (!utf8) + return 0; + /* Ick. Now I'm implementing my own UTF8 handling too. Perhaps it's time to bite the bullet and start requiring something like glib? */ while (*utf8) { -- 2.49.0