From 0781e12f45b4416ad37da143ab9fb5235cc8c283 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 18 Nov 2022 16:34:06 +0000 Subject: [PATCH] tests: Add additional assertions to gsubprocess test This should quell a scan-build warning about passing `NULL` to `strlen()`. Signed-off-by: Philip Withnall --- gio/tests/gsubprocess.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c index 036c2afad..515a11267 100644 --- a/gio/tests/gsubprocess.c +++ b/gio/tests/gsubprocess.c @@ -757,11 +757,15 @@ on_communicate_complete (GObject *proc, { if (data->is_utf8) { + g_assert_nonnull (stdout_str); stdout_data = (guint8*)stdout_str; stdout_len = strlen (stdout_str); } else - stdout_data = g_bytes_get_data (stdout_bytes, &stdout_len); + { + g_assert_nonnull (stdout_bytes); + stdout_data = g_bytes_get_data (stdout_bytes, &stdout_len); + } g_assert_cmpmem (stdout_data, stdout_len, "# hello world" LINEEND, 13 + strlen (LINEEND)); }