Properly handled a case when addition was wrongly assumed
This commit is contained in:
+4
-3
@@ -71,7 +71,7 @@ Command resolveCommand()
|
|||||||
|
|
||||||
bool shouldQuit = token.find("q") != token.npos;
|
bool shouldQuit = token.find("q") != token.npos;
|
||||||
bool shouldPrint = token.find("p") != token.npos;
|
bool shouldPrint = token.find("p") != token.npos;
|
||||||
char operation;
|
char operation = 0;
|
||||||
|
|
||||||
for (const char c: token)
|
for (const char c: token)
|
||||||
{
|
{
|
||||||
@@ -80,11 +80,12 @@ Command resolveCommand()
|
|||||||
{
|
{
|
||||||
operation = c;
|
operation = c;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
if (operation == 0)
|
||||||
{
|
{
|
||||||
operation = '+';
|
operation = '+';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return {shouldQuit, operation, validation_result.next_arg(), shouldPrint};
|
return {shouldQuit, operation, validation_result.next_arg(), shouldPrint};
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user