Skip to content

Commit

Permalink
Merge pull request #709 from kareltucek/fix_set_led_txt_token_consump…
Browse files Browse the repository at this point in the history
…tion

Fix setLedTxt to consume parameters correctly.
  • Loading branch information
mondalaci authored Oct 3, 2023
2 parents 97d3dc0 + c5f953e commit ce37e64
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions right/src/macros/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,14 +874,16 @@ static macro_result_t processSetLedTxtCommand(parser_context_t* ctx)
textLen = 3;
} else if (ctx->at != ctx->end) {
uint16_t stringOffset = 0, textIndex = 0, textSubIndex = 0;
for (uint8_t i = 0; i < 3; i++) {
text[i] = Macros_ConsumeCharOfString(ctx, &stringOffset, &textIndex, &textSubIndex);
if (text[i] != '\0') {
for (uint8_t i = 0; true; i++) {
char c = Macros_ConsumeCharOfString(ctx, &stringOffset, &textIndex, &textSubIndex);
if (c == '\0') {
break;
}
if (i < 3) {
text[i] = c;
textLen++;
}
}
ctx->at += stringOffset;
ctx->at += textIndex;
ConsumeWhite(ctx);
} else {
Macros_ReportError("Text argument expected.", ctx->at, ctx->at);
Expand Down

0 comments on commit ce37e64

Please sign in to comment.