From e1408326760c9fbebbcd24025586ad211f00d3ca Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Wed, 29 Jan 2025 19:07:18 +0100 Subject: [PATCH 1/2] Prevent crash when macro contains invalid action or condition --- lib/macro/macro.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/macro/macro.cpp b/lib/macro/macro.cpp index 9209449d8..2e1ac6299 100644 --- a/lib/macro/macro.cpp +++ b/lib/macro/macro.cpp @@ -246,6 +246,10 @@ bool Macro::CheckConditions(bool ignorePause) _matched = false; for (auto &condition : _conditions) { + if (!condition) { + continue; + } + if (_paused && !ignorePause) { vblog(LOG_INFO, "Macro %s is paused", _name.c_str()); return false; @@ -383,6 +387,9 @@ bool Macro::RunActionsHelper( bool actionsExecutedSuccessfully = true; for (auto &action : actions) { + if (!action) { + continue; + } if (action->Enabled()) { action->LogAction(); actionsExecutedSuccessfully = From ce8bbbf5d9c4d7d333490f44e5588f9a8dab5b66 Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Wed, 29 Jan 2025 19:08:04 +0100 Subject: [PATCH 2/2] Fix script actions / conditions not working after stopping macro --- lib/macro/macro.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/macro/macro.cpp b/lib/macro/macro.cpp index 2e1ac6299..63a920a1a 100644 --- a/lib/macro/macro.cpp +++ b/lib/macro/macro.cpp @@ -244,6 +244,7 @@ bool Macro::CheckConditions(bool ignorePause) return false; } + _stop = false; _matched = false; for (auto &condition : _conditions) { if (!condition) {