forked from Spencer/math_shell
CHECK YOUR INPUT IDIOT
This commit is contained in:
4
msh.c
4
msh.c
@@ -318,7 +318,9 @@ int mathTest() {
|
||||
#endif
|
||||
printf("%d %c %d = ", num1, mathOperation[randProblem], num2);
|
||||
numLine = readline("");
|
||||
sscanf(numLine, "%ld", &numAnswer);
|
||||
if (numLine != NULL && strlen(numLine) > 0) {
|
||||
sscanf(numLine, "%ld", &numAnswer);
|
||||
}
|
||||
|
||||
if (numSolution != numAnswer) { // If wrong answer
|
||||
status = 1;
|
||||
|
||||
Reference in New Issue
Block a user