From ea226228f57e114a4a0da38ed82375dedb944691 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 24 Jun 2022 17:43:53 +0200 Subject: [PATCH] Fix shutter exception 29 Fix shutter exception 29 (#15825) --- tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino index 6a8d8ca5e..9c3080c3c 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino @@ -1245,7 +1245,12 @@ void CmndShutterPosition(void) ShutterReportPosition(true, index); } XdrvMailbox.index = index +1; // Fix random index for ShutterClose - strcpy( XdrvMailbox.command , D_CMND_SHUTTER_POSITION); + + // As this function is called three times from outside the command handler + // XdrvMailbox.command may not point to a char string resulting in exception 29 on strcpy + char command[CMDSZ] = { 0 }; + XdrvMailbox.command = command; + strcpy(XdrvMailbox.command, D_CMND_SHUTTER_POSITION); ResponseCmndIdxNumber((Settings->shutter_options[index] & 1) ? 100 - target_pos_percent : target_pos_percent); } else { ShutterReportPosition(true, MAX_SHUTTERS);