add nullptr check
This commit is contained in:
parent
5ac88f2b15
commit
085213c60f
@ -375,13 +375,16 @@ float MgmLIS3MDLHandler::getSensitivityFactor(MGMLIS3MDL::Sensitivies sens) {
|
|||||||
|
|
||||||
ReturnValue_t MgmLIS3MDLHandler::enableTemperatureSensor(const uint8_t *commandData,
|
ReturnValue_t MgmLIS3MDLHandler::enableTemperatureSensor(const uint8_t *commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
|
if(commandData == nullptr) {
|
||||||
|
return INVALID_COMMAND_PARAMETER;
|
||||||
|
}
|
||||||
triggerEvent(CHANGE_OF_SETUP_PARAMETER);
|
triggerEvent(CHANGE_OF_SETUP_PARAMETER);
|
||||||
uint32_t size = 2;
|
uint32_t size = 2;
|
||||||
commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1);
|
commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1);
|
||||||
if (commandDataLen > 1) {
|
if (commandDataLen > 1) {
|
||||||
return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS;
|
return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS;
|
||||||
}
|
}
|
||||||
switch (*commandData) {
|
switch (commandData[0]) {
|
||||||
case (MGMLIS3MDL::ON): {
|
case (MGMLIS3MDL::ON): {
|
||||||
commandBuffer[1] = registers[0] | (1 << 7);
|
commandBuffer[1] = registers[0] | (1 << 7);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user