Skip to content

Commit

Permalink
fix build warning, if jswrap_i2c_readReg called on an undefined paren…
Browse files Browse the repository at this point in the history
…t it could return an undefined value
  • Loading branch information
gfwilliams committed Jan 25, 2024
1 parent ddd7ad7 commit e3736ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jswrap_spi_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,10 @@ I2C.readReg = function(address, reg, quantity) {
```
*/
JsVar *jswrap_i2c_readReg(JsVar *parent, int address, int reg, int nBytes) {
if (!jsvIsObject(parent)) return;
if (!jsvIsObject(parent)) return 0;
IOEventFlags device = jsiGetDeviceFromClass(parent);
bool sendStop = false;
unsigned char i2cReg = (unsigned char)reg;
_jswrap_i2c_writeTo(parent, device, address, sendStop, 1, &i2cReg);
return _jswrap_i2c_readFrom(parent, device, address, sendStop, nBytes);
}
}

0 comments on commit e3736ac

Please sign in to comment.