From 78ef5159fcc54dc8d4fa30a5949a8676e0d304c0 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Thu, 18 Feb 2016 12:32:00 +0100 Subject: Fix segfault if server is not running --- uca-net-camera.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'uca-net-camera.c') diff --git a/uca-net-camera.c b/uca-net-camera.c index 849d446..d9d561b 100644 --- a/uca-net-camera.c +++ b/uca-net-camera.c @@ -520,10 +520,12 @@ uca_net_camera_constructed (GObject *object) priv->connection = g_socket_client_connect_to_host (priv->client, priv->host, UCA_NET_DEFAULT_PORT, NULL, &priv->construct_error); - /* ask for additional camera properties */ - if (send_default_message (priv->connection, UCA_NET_MESSAGE_GET_PROPERTIES, &priv->construct_error)) - read_get_properties_reply (object, g_io_stream_get_input_stream (G_IO_STREAM (priv->connection)), - &priv->construct_error); + if (priv->connection != NULL) { + /* ask for additional camera properties */ + if (send_default_message (priv->connection, UCA_NET_MESSAGE_GET_PROPERTIES, &priv->construct_error)) + read_get_properties_reply (object, g_io_stream_get_input_stream (G_IO_STREAM (priv->connection)), + &priv->construct_error); + } } static void -- cgit v1.2.3