LIS3 handler nullptr check #64

Merged
meierj merged 2 commits from mueller/lis3-handler-nullptr-check into eive/develop 2022-04-21 13:55:06 +02:00
Showing only changes of commit 085213c60f - Show all commits

View File

@ -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;