summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-07-28 13:35:29 +0200
committerSven Gothel <[email protected]>2020-07-28 13:35:29 +0200
commit1ba7f051b9aae0913680d6a33fd660c248e89722 (patch)
tree485fb2604799ef55195a898bed12a4861dccf4aa /src
parent779610b70b982ddb6510f83e9c86a589eae0f89f (diff)
DBTAdapter::ctor: Avoid using adapterInfo before initialized (SIGSEGV)
Diffstat (limited to 'src')
-rw-r--r--src/direct_bt/DBTAdapter.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp
index 896f0114..b38d211e 100644
--- a/src/direct_bt/DBTAdapter.cpp
+++ b/src/direct_bt/DBTAdapter.cpp
@@ -159,19 +159,21 @@ bool DBTAdapter::validateDevInfo() {
keepDiscoveringAlive = false;
if( 0 > dev_id ) {
- ERR_PRINT("DBTAdapter::validateDevInfo: Invalid negative dev_id: %s", toString().c_str());
+ ERR_PRINT("DBTAdapter::validateDevInfo: Invalid negative dev_id %d", dev_id);
return false;
}
if( !mgmt.isOpen() ) {
- ERR_PRINT("DBTAdapter::validateDevInfo: Manager not open: %s", toString().c_str());
+ ERR_PRINT("DBTAdapter::validateDevInfo: Manager not open on dev_id %d", dev_id);
return false;
}
+
+ adapterInfo = mgmt.getAdapterInfo(dev_id);
+
if( !openHCI() ) {
ERR_PRINT("DBTAdapter::validateDevInfo: Opening adapter's HCI failed: %s", toString().c_str());
return false;
}
- adapterInfo = mgmt.getAdapterInfo(dev_id);
mgmt.addMgmtEventCallback(dev_id, MgmtEvent::Opcode::DISCOVERING, bindMemberFunc(this, &DBTAdapter::mgmtEvDeviceDiscoveringMgmt));
mgmt.addMgmtEventCallback(dev_id, MgmtEvent::Opcode::NEW_SETTINGS, bindMemberFunc(this, &DBTAdapter::mgmtEvNewSettingsMgmt));
mgmt.addMgmtEventCallback(dev_id, MgmtEvent::Opcode::LOCAL_NAME_CHANGED, bindMemberFunc(this, &DBTAdapter::mgmtEvLocalNameChangedMgmt));