gio/tests: Add non-NULL assertions to help static analysis

These prevent some false positives from the static analyser which are
caused by it not inspecting the invariants of
g_subprocess_communicate[_utf8]_finish() (i.e. that stdout and
stdout_str will always be set unless an error was returned).

They’re also good testing anyway.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
This commit is contained in:
Philip Withnall 2013-11-26 11:18:35 +00:00
parent fe004445a4
commit c9ccc2af91

View File

@ -583,10 +583,12 @@ on_communicate_complete (GObject *proc,
if (!data->is_utf8)
{
g_assert (stdout != NULL);
stdout_data = g_bytes_get_data (stdout, &stdout_len);
}
else
{
g_assert (stdout_str != NULL);
stdout_data = (guint8*)stdout_str;
stdout_len = strlen (stdout_str);
}