1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2025-07-28 04:43:28 +02:00

tests: Add additional assertions to gsubprocess test

This should quell a scan-build warning about passing `NULL` to
`strlen()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall
2022-11-18 16:34:06 +00:00
parent c1a4aca743
commit 0781e12f45

@@ -757,11 +757,15 @@ on_communicate_complete (GObject *proc,
{ {
if (data->is_utf8) if (data->is_utf8)
{ {
g_assert_nonnull (stdout_str);
stdout_data = (guint8*)stdout_str; stdout_data = (guint8*)stdout_str;
stdout_len = strlen (stdout_str); stdout_len = strlen (stdout_str);
} }
else else
{
g_assert_nonnull (stdout_bytes);
stdout_data = g_bytes_get_data (stdout_bytes, &stdout_len); stdout_data = g_bytes_get_data (stdout_bytes, &stdout_len);
}
g_assert_cmpmem (stdout_data, stdout_len, "# hello world" LINEEND, 13 + strlen (LINEEND)); g_assert_cmpmem (stdout_data, stdout_len, "# hello world" LINEEND, 13 + strlen (LINEEND));
} }