diff --git a/libraries/AP_HAL_F4Light/I2CDevice.cpp b/libraries/AP_HAL_F4Light/I2CDevice.cpp index 6801568681..1398eb4d7a 100644 --- a/libraries/AP_HAL_F4Light/I2CDevice.cpp +++ b/libraries/AP_HAL_F4Light/I2CDevice.cpp @@ -187,13 +187,16 @@ void I2CDevice::init(){ if(_dev) { i2c_init(_dev, _offs, _slow?I2C_250KHz_SPEED:I2C_400KHz_SPEED); - }else { + }else if (s_i2c){ s_i2c->init( ); if(_slow) { s_i2c->set_low_speed(true); } } + else { // neither hardware nor software initalization was successful + return; + } _initialized=true; }