Fix possible exception when irreceive is not initialised

Fix possible exception when irreceive is not initialised
This commit is contained in:
Theo Arends 2019-07-08 12:24:31 +02:00
parent 56383d3758
commit e67b27b0a3

View File

@ -118,9 +118,11 @@ unsigned long ir_lasttime = 0;
void IrReceiveUpdateThreshold() void IrReceiveUpdateThreshold()
{ {
if (irrecv != nullptr) {
if (Settings.param[P_IR_UNKNOW_THRESHOLD] < 6) { Settings.param[P_IR_UNKNOW_THRESHOLD] = 6; } if (Settings.param[P_IR_UNKNOW_THRESHOLD] < 6) { Settings.param[P_IR_UNKNOW_THRESHOLD] = 6; }
irrecv->setUnknownThreshold(Settings.param[P_IR_UNKNOW_THRESHOLD]); irrecv->setUnknownThreshold(Settings.param[P_IR_UNKNOW_THRESHOLD]);
} }
}
void IrReceiveInit(void) void IrReceiveInit(void)
{ {