1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-02-23 00:56:03 +01:00

Bugfix: trailing > in command was not replaced with \0 which did break <+> commands

This commit is contained in:
Harald Barth 2025-01-31 11:19:22 +01:00
parent 0154e7fd78
commit 41168a9dd8

View File

@ -167,8 +167,10 @@ int16_t DCCEXParser::splitValues(int16_t result[MAX_COMMAND_PARAMS], byte *cmd,
break; break;
if (hot == '\0') if (hot == '\0')
return -1; return -1;
if (hot == '>') if (hot == '>') {
*remainingCmd = '\0'; // terminate the cmd string with 0 instead of '>'
return parameterCount; return parameterCount;
}
state = 2; state = 2;
continue; continue;
@ -265,8 +267,9 @@ void DCCEXParser::parse(const FSH * cmd) {
// See documentation on DCC class for info on this section // See documentation on DCC class for info on this section
void DCCEXParser::parse(Print *stream, byte *com, RingStream *ringStream) { void DCCEXParser::parse(Print *stream, byte *com, RingStream *ringStream) {
// This function can get stings of the form "<C OMM AND>" or "C OMM AND" // This function can get stings of the form "<C OMM AND>" or "C OMM AND>"
// found is true first after the leading "<" has been passed // found is true first after the leading "<" has been passed which results
// in parseOne() getting c="C OMM AND>"
bool found = (com[0] != '<'); bool found = (com[0] != '<');
for (byte *c=com; c[0] != '\0'; c++) { for (byte *c=com; c[0] != '\0'; c++) {
if (found) { if (found) {