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

The static analyser (correctly) considers a type check to fail if the
variable is NULL. In this case, the address must be non-NULL as no error
was thrown by g_socket_connection_get_remote_address(), but the static
analyser doesn’t know this.

Add a non-NULL assertion anyway, both to shut the analyser up, and
because it’s good extra testing.

Found by scan-build.

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

View File

@ -889,7 +889,7 @@ assert_direct (GSocketConnection *conn)
addr = g_socket_connection_get_remote_address (conn, &error);
g_assert_no_error (error);
g_assert (!G_IS_PROXY_ADDRESS (addr));
g_assert (addr != NULL && !G_IS_PROXY_ADDRESS (addr));
g_object_unref (addr);
addr = g_socket_connection_get_local_address (conn, &error);