From 019001675e6637b60f4a7e59cd3c9a6e692b81a2 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 27 Oct 2020 07:24:48 +0100 Subject: [PATCH] return false if parseS does not find any sensors --- DCCEXParser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index b1eb631..9432a4f 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -436,7 +436,7 @@ bool DCCEXParser::parseZ(Print *stream, int params, int p[]) case 3: // if (!Output::create(p[0], p[1], p[2], 1)) - return false; + return false; StringFormatter::send(stream, F("")); return true; @@ -554,7 +554,7 @@ bool DCCEXParser::parseS(Print *stream, int params, int p[]) case 3: // create sensor. pullUp indicator (0=LOW/1=HIGH) if (!Sensor::create(p[0], p[1], p[2])) return false; - StringFormatter::send(stream, F("")); + StringFormatter::send(stream, F("")); return true; case 1: // S id> remove sensor @@ -564,6 +564,8 @@ bool DCCEXParser::parseS(Print *stream, int params, int p[]) return true; case 0: // lit sensor states + if (Sensor::firstSensor == NULL) + return false; for (Sensor *tt = Sensor::firstSensor; tt != NULL; tt = tt->nextSensor) { StringFormatter::send(stream, F(""), tt->data.snum, tt->data.pin, tt->data.pullUp);