aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2020-07-16 15:51:01 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2020-07-20 18:15:44 +0000
commit5fdc7afba453f4f27b22364dd3c974eb9ec0ef46 (patch)
tree374b1760f5a3a6bef3039dba616b648412f6e34a
parentaac4579ebb54e00178daf45fc255f0fb9f8e220b (diff)
add missing guards in bluetooth-util.c
This change should have been part of commit c5db00e, but was by mistake left behind. This change includes guards against null pointers in case of a system with no bluetooth adapter. Bug-AGL: SPEC-3301 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: I01cf72515a8e1e28fa26974927adb605c1a06dbd
-rw-r--r--binding/bluetooth-util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/binding/bluetooth-util.c b/binding/bluetooth-util.c
index 21bd0df..a1e15f0 100644
--- a/binding/bluetooth-util.c
+++ b/binding/bluetooth-util.c
@@ -1047,6 +1047,9 @@ gchar *return_bluez_path(afb_req_t request) {
const char *adapter = afb_req_value(request, "adapter");
const char *device, *tmp;
+ if (!ns || (!adapter && !ns->adapter))
+ return NULL;
+
call_work_lock(ns);
adapter = adapter ? adapter : ns->adapter;
call_work_unlock(ns);