jsonplatform.c: Add fix for dereferencing of a null pointer
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
committed by
Mihai Tudor Panu
parent
5d6f0ef296
commit
6e85bcd902
@@ -291,7 +291,11 @@ mraa_init_json_platform_i2c(json_object* jobj_i2c, mraa_board_t* board, int inde
|
||||
json_object* jobj_temp = NULL;
|
||||
|
||||
// Default to no mux pins defined
|
||||
if(board->pins != NULL) {
|
||||
board->pins[pin].i2c.mux_total = 0;
|
||||
} else {
|
||||
return MRAA_ERROR_NO_DATA_AVAILABLE;
|
||||
}
|
||||
|
||||
// Get the I2C bus array index
|
||||
ret = mraa_init_json_platform_get_index(jobj_i2c, I2C_KEY, INDEX_KEY, index, &pos, board->i2c_bus_count - 1);
|
||||
|
||||
Reference in New Issue
Block a user