From e67b27b0a314d00e25cf703e205fb93b843710bd Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 8 Jul 2019 12:24:31 +0200 Subject: [PATCH] Fix possible exception when irreceive is not initialised Fix possible exception when irreceive is not initialised --- sonoff/xdrv_05_irremote.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sonoff/xdrv_05_irremote.ino b/sonoff/xdrv_05_irremote.ino index 4444b1da9..93bc3d6b3 100644 --- a/sonoff/xdrv_05_irremote.ino +++ b/sonoff/xdrv_05_irremote.ino @@ -118,8 +118,10 @@ unsigned long ir_lasttime = 0; void IrReceiveUpdateThreshold() { - if (Settings.param[P_IR_UNKNOW_THRESHOLD] < 6) { Settings.param[P_IR_UNKNOW_THRESHOLD] = 6; } - irrecv->setUnknownThreshold(Settings.param[P_IR_UNKNOW_THRESHOLD]); + if (irrecv != nullptr) { + if (Settings.param[P_IR_UNKNOW_THRESHOLD] < 6) { Settings.param[P_IR_UNKNOW_THRESHOLD] = 6; } + irrecv->setUnknownThreshold(Settings.param[P_IR_UNKNOW_THRESHOLD]); + } } void IrReceiveInit(void)