android/avrcp: Fix warnings when freeing avrcp_device struct
If the device does not yet have queue due to not have a session it cause
the following warnings when avrcp_device_free is called:
(bluetoothd:1102): GLib-CRITICAL **: g_queue_foreach: assertion 'queue != NULL' failed
(bluetoothd:1102): GLib-CRITICAL **: g_queue_free: assertion 'queue != NULL' failed
diff --git a/android/avrcp.c b/android/avrcp.c
index 911b1df..1d211ad 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
@@ -442,8 +442,10 @@
{
struct avrcp_device *dev = data;
- g_queue_foreach(dev->queue, (GFunc) g_free, NULL);
- g_queue_free(dev->queue);
+ if (dev->queue) {
+ g_queue_foreach(dev->queue, (GFunc) g_free, NULL);
+ g_queue_free(dev->queue);
+ }
if (dev->session)
avrcp_shutdown(dev->session);