AP_Compass: prevent use of null dev_icm device in ICM20948 driver

This commit is contained in:
Andrew Tridgell 2018-07-14 07:43:43 +10:00
parent ed09467f06
commit 3c0ed01fd0

View File

@ -77,7 +77,7 @@ AP_Compass_Backend *AP_Compass_AK09916::probe_ICM20948(Compass &compass,
bool force_external,
enum Rotation rotation)
{
if (!dev) {
if (!dev || !dev_icm) {
return nullptr;
}
AP_Compass_AK09916 *sensor = new AP_Compass_AK09916(compass, std::move(dev), std::move(dev_icm),