mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 07:56:17 +01:00
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:
parent
fe004445a4
commit
c9ccc2af91
@ -583,10 +583,12 @@ on_communicate_complete (GObject *proc,
|
|||||||
|
|
||||||
if (!data->is_utf8)
|
if (!data->is_utf8)
|
||||||
{
|
{
|
||||||
|
g_assert (stdout != NULL);
|
||||||
stdout_data = g_bytes_get_data (stdout, &stdout_len);
|
stdout_data = g_bytes_get_data (stdout, &stdout_len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
g_assert (stdout_str != NULL);
|
||||||
stdout_data = (guint8*)stdout_str;
|
stdout_data = (guint8*)stdout_str;
|
||||||
stdout_len = strlen (stdout_str);
|
stdout_len = strlen (stdout_str);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user