tcpclientsrc, tcpserversrc: don't try to get stats from NULL socket

Fixes criticals during gst-inspect.

Wasn't an issue before because the entire stats gathering
code path was inactive.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8211>
This commit is contained in:
Tim-Philipp Müller 2025-01-04 12:20:18 +00:00
parent b4bef7fd35
commit 64970e721f
2 changed files with 4 additions and 2 deletions

View file

@ -566,7 +566,8 @@ gst_tcp_client_src_get_stats (GstTCPClientSrc * src)
s = gst_structure_new ("GstTCPClientSrcStats",
"bytes-received", G_TYPE_UINT64, src->bytes_received, NULL);
gst_tcp_stats_from_socket (s, src->socket);
if (src->socket != NULL)
gst_tcp_stats_from_socket (s, src->socket);
return s;
}

View file

@ -596,7 +596,8 @@ gst_tcp_server_src_get_stats (GstTCPServerSrc * src)
s = gst_structure_new ("GstTCPServerSrcStats",
"bytes-received", G_TYPE_UINT64, src->bytes_received, NULL);
gst_tcp_stats_from_socket (s, src->client_socket);
if (src->client_socket != NULL)
gst_tcp_stats_from_socket (s, src->client_socket);
return s;
}