Skip to content

Commit

Permalink
Fix a bug when loading certain macros from device
Browse files Browse the repository at this point in the history
A macro like this:

[
    [
        "0x00070004",
        "0x00070005"
    ],
    [
        "0x00070006"
    ],
    [
        "0x00070007"
    ]
]

would load back as:

[
    [
        "0x00070004",
        "0x00070005"
    ],
    [
        "0x00070006"
    ],
    []
]
  • Loading branch information
jfedor2 committed Jan 9, 2024
1 parent 7662655 commit dfed957
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion firmware/src/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ uint16_t handle_get_report1(uint8_t report_id, uint8_t* buffer, uint16_t reqlen)
i++;
}
my_mutex_exit(MutexId::MACROS);
if (exhausted && (ret_idx > 0)) {
if (exhausted && (ret_idx > 0) && (returned->usages[ret_idx - 1] == 0)) {
ret_idx--;
}
returned->nitems = ret_idx;
Expand Down

0 comments on commit dfed957

Please sign in to comment.