incomplete changeDevice

This commit is contained in:
2020-12-17 13:44:49 +01:00
parent 12db917466
commit 6b976f22cf

View File

@ -221,6 +221,13 @@ static bool changeDeviceCmd(uint8_t argc, char **args) {
return makeDevice(0, argc, args, NULL); return makeDevice(0, argc, args, NULL);
} }
long int rawIndex = strtol(args[1], NULL, 10);
if (rawIndex < 0 || rawIndex > getConfig()->numOfDeviceBlocks) {
sendFormatString("illegal index, must be greater 0 and less %d\n\r", getConfig()->numOfDeviceBlocks);
return false;
}
uint8_t index = (uint8_t) rawIndex;
t_deviceBlock deviceBlock; t_deviceBlock deviceBlock;
uint8_t index; uint8_t index;
bool retCode = makeDevice(1, argc, args, &deviceBlock); bool retCode = makeDevice(1, argc, args, &deviceBlock);