RangeFinder: fixed a crash when VL53L0X was enabled in the software but not connected.

This commit is contained in:
Dmitri Ranfft 2018-05-04 17:42:52 +02:00 committed by Andrew Tridgell
parent 776d5e6ba3
commit 8fa281fa5b

View File

@ -228,6 +228,9 @@ AP_RangeFinder_VL53L0X::AP_RangeFinder_VL53L0X(RangeFinder::RangeFinder_State &_
*/
AP_RangeFinder_Backend *AP_RangeFinder_VL53L0X::detect(RangeFinder::RangeFinder_State &_state, AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev)
{
if(!dev){
return nullptr;
}
AP_RangeFinder_VL53L0X *sensor
= new AP_RangeFinder_VL53L0X(_state, std::move(dev));