Fix '0' being interpreted as a count prefix instead of a command

This commit is contained in:
Josh Holtrop 2017-11-14 20:42:41 -05:00
parent c2b50a3f4f
commit 4b9987b119

View File

@ -72,7 +72,9 @@ uint8_t CommandMap::scan_units(
for (size_t i = 0u; i < length; i++)
{
uint32_t c = command_characters[i];
if (gathering_count && ('0' <= c) && (c <= '9'))
if (gathering_count &&
((('1' <= c) && (c <= '9')) ||
((c == '0') && (unit.count != 0u))))
{
unit.count *= 10u;
unit.count += (c - '0');