It is safe to just call queue_peak_head on empty queue. Now its also safe to pass NULL to send_client_char_notify as status will be set inside it. --- android/gatt.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/android/gatt.c b/android/gatt.c index cad7e1a..dcc533c 100644 --- a/android/gatt.c +++ b/android/gatt.c @@ -1023,11 +1023,8 @@ static void discover_char_cb(uint8_t status, GSList *characteristics, cache_all_srvc_chars(characteristics, data->service->chars); - if (!queue_isempty(data->service->chars)) - send_client_char_notify(queue_peek_head(data->service->chars), - data->conn_id, data->service); - else - send_client_char_notify(NULL, data->conn_id, data->service); + send_client_char_notify(queue_peek_head(data->service->chars), + data->conn_id, data->service); free(data); } -- 1.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html