Check return value of bt_adapter_get_state() 65/262965/1 accepted/tizen_6.0_unified accepted/tizen/6.0/unified/20210826.123235 submit/tizen_6.0/20210825.084736
authorLohit Agarwalla <l.agarwalla@samsung.com>
Mon, 23 Aug 2021 11:31:09 +0000 (17:01 +0530)
committerRandeep Singh <randeep.s@samsung.com>
Tue, 24 Aug 2021 05:23:51 +0000 (05:23 +0000)
Change-Id: I6dfdce96f30a6b6dce9f1627e5014e182e4d790d
Signed-off-by: Lohit Agarwalla <l.agarwalla@samsung.com>
common/cryptoutil/src/AsmCrypto.cpp

index c8bb565..a993edf 100644 (file)
@@ -161,9 +161,19 @@ AsmCrypto::getAsmToken(void)
 
        char *mac = NULL;
 
-       bt_initialize();
+       int ret = bt_initialize();
+       if (ret != BT_ERROR_NONE) {
+                _ERR("bt_initialize() failed.");
+                return std::string();
+        }
+
        bt_adapter_state_e btState;
-       bt_adapter_get_state(&btState);
+       ret = bt_adapter_get_state(&btState);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("Failed to get bt_adapter state");
+               return std::string();
+       }
+
        if (btState == BT_ADAPTER_ENABLED) {
                bt_adapter_get_address(&mac);
                if (mac != NULL) {