From 42fa7fa74b83b0b1a6d3cb8ab38126b1e2979c3d Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 11 Dec 2014 15:42:35 +0100 Subject: [PATCH] android/gatt: Fix removing invalid IO channel With single mode controller LE or BR/EDR IO might be NULL. --- android/gatt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/android/gatt.c b/android/gatt.c index 71112a259..2aa52b09e 100644 --- a/android/gatt.c +++ b/android/gatt.c @@ -7168,11 +7168,15 @@ void bt_gatt_unregister(void) gatt_db_unref(gatt_db); gatt_db = NULL; - g_io_channel_unref(le_io); - le_io = NULL; + if (le_io) { + g_io_channel_unref(le_io); + le_io = NULL; + } - g_io_channel_unref(bredr_io); - bredr_io = NULL; + if (bredr_io) { + g_io_channel_unref(bredr_io); + bredr_io = NULL; + } if (gap_sdp_handle) { bt_adapter_remove_record(gap_sdp_handle); -- 2.47.3