aboutsummaryrefslogtreecommitdiffstats
path: root/src/direct_bt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-10-17 01:56:06 +0200
committerSven Gothel <[email protected]>2020-10-17 01:56:06 +0200
commitbb84b7ddeb10ed5957f746cf28da606aea4eaa46 (patch)
tree80c4318843e8fba4a4a7b23b4f70c69594b635fb /src/direct_bt
parent2b848e814f624d306980e7cfa9a133541bdf5cb2 (diff)
direct_bt::DBTManager, ieee11073::DataTypes: Fix Warnings
Diffstat (limited to 'src/direct_bt')
-rw-r--r--src/direct_bt/DBTManager.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp
index 454e6f6f..0778457e 100644
--- a/src/direct_bt/DBTManager.cpp
+++ b/src/direct_bt/DBTManager.cpp
@@ -612,8 +612,13 @@ ScanType DBTManager::startDiscovery(const int dev_id, const ScanType scanType) n
ScanType type = ScanType::NONE;
if( nullptr != res && res->getOpcode() == MgmtEvent::Opcode::CMD_COMPLETE ) {
const MgmtEvtCmdComplete &res1 = *static_cast<const MgmtEvtCmdComplete *>(res.get());
- if( MgmtStatus::SUCCESS == res1.getStatus() && 1 == res1.getDataSize() ) {
- type = static_cast<ScanType>( *res1.getData() );
+ if( MgmtStatus::SUCCESS == res1.getStatus() && 1 <= res1.getDataSize() ) {
+ const uint8_t *p = res1.getData();
+ if( nullptr == p ) { // G++ 10: -Werror=null-dereference
+ ERR_PRINT("DBTManager::startDiscovery: Impossible MgmtEvtCmdComplete data nullptr: %s - %s", res1.toString().c_str(), req.toString().c_str());
+ return type;
+ }
+ type = static_cast<ScanType>( p[0] );
}
}
return type;