CHECK YOUR INPUT IDIOT

This commit is contained in:
2022-12-15 13:08:16 -05:00
committed by Pin
parent d961ddc36a
commit 43dce73c81

4
msh.c
View File

@@ -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;