diff --git a/msh.c b/msh.c index 590a655..fe66427 100644 --- a/msh.c +++ b/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;