Private
Public Access
2
0

i2c.c: Added check for NULL i2c context

Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Henry Bruce
2015-09-16 15:19:20 -07:00
committed by Brendan Le Foll
parent 0aac9df414
commit 1a29dc9910

View File

@@ -336,6 +336,10 @@ mraa_i2c_write_word_data(mraa_i2c_context dev, const uint16_t data, const uint8_
mraa_result_t
mraa_i2c_address(mraa_i2c_context dev, uint8_t addr)
{
if (dev == NULL) {
return MRAA_ERROR_INVALID_HANDLE;
}
dev->addr = (int) addr;
if (IS_FUNC_DEFINED(dev, i2c_address_replace)) {
return dev->advance_func->i2c_address_replace(dev, addr);