Add null check to prevent crash in case connection is deleted.
authorDebi Prasanna Mohanty <debi.m@samsung.com>
Mon, 27 Feb 2017 17:06:57 +0000 (22:36 +0530)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 16 Feb 2023 10:00:17 +0000 (19:00 +0900)
Change-Id: Ib4b2f80620b0e5fd08899c62e4df27f7afc10a05
Signed-off-by: Debi Prasanna Mohanty <debi.m@samsung.com>
src/connection.c

index 03767c2..0084804 100644 (file)
@@ -489,7 +489,10 @@ wl_message_count_arrays(const struct wl_message *message)
 int
 wl_connection_get_fd(struct wl_connection *connection)
 {
-       return connection->fd;
+       if (connection)
+               return connection->fd;
+       else
+               return -1;
 }
 
 static int