From 8085d03d65cf6e3aeb102c96fad1de09b2c259b3 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 31 Mar 2022 10:11:34 +0100 Subject: [PATCH] fix --- EXRAIL2.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index c5f77c1..669a632 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -357,27 +357,27 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) { default: break; } - + + // check KILL ALL here, otherwise the next validation confuses ALL with a flag + if (p[0]==HASH_KEYWORD_KILL && p[1]==HASH_KEYWORD_ALL) { + while (loopTask) delete loopTask; // destructor changes loopTask + return true; + } + // all other / commands take 1 parameter 0 to MAX_FLAGS-1 - if (paramCount!=2 || p[1]<0 || p[1]>=MAX_FLAGS) return false; switch (p[0]) { case HASH_KEYWORD_KILL: // Kill taskid|ALL { - if (p[1]==HASH_KEYWORD_ALL) { - while (loopTask) delete loopTask; - return true; - } - RMFT2 * task=loopTask; while(task) { - if (task->taskId==p[1]) { - delete task; - return true; - } - task=task->next; - if (task==loopTask) break; + if (task->taskId==p[1]) { + delete task; + return true; + } + task=task->next; + if (task==loopTask) break; } } return false;