agent: fix crash with debugging enabled
authorMichael Olbrich <m.olbrich@pengutronix.de>
Mon, 9 Jul 2018 12:52:08 +0000 (14:52 +0200)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Sun, 21 Oct 2018 08:17:30 +0000 (08:17 +0000)
For some connection types nicesock->fileno is never set.
Make sure it is not NULL before using it.

agent/agent.c

index ddad077..db3067e 100644 (file)
@@ -3889,7 +3889,7 @@ agent_recv_message_unlocked (
     nice_address_to_string (message->from, tmpbuf);
     nice_debug_verbose ("%s: Agent %p : Packet received on local socket %p "
         "(fd %d) from [%s]:%u (%" G_GSSIZE_FORMAT " octets).", G_STRFUNC, agent,
-        nicesock, g_socket_get_fd (nicesock->fileno), tmpbuf,
+        nicesock, nicesock->fileno ? g_socket_get_fd (nicesock->fileno) : -1, tmpbuf,
         nice_address_get_port (message->from), message->length);
   }