aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-05-31 23:23:17 +0900
committerTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-05-31 23:23:17 +0900
commit0f951e2d72606854ce2689f201332f551a5a2b81 (patch)
treeaf1b054cfebc8e8a938cbcc1ac9f8de18de6ad49 /src
parent8a19837e71773af2405b6c4c64eeef0fbc9e3b22 (diff)
Check user input before using it
Diffstat (limited to 'src')
-rw-r--r--src/calculer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/calculer.c b/src/calculer.c
index 0c9fe8b..2d6c973 100644
--- a/src/calculer.c
+++ b/src/calculer.c
@@ -81,7 +81,7 @@ main(void)
sprintf(prompt, "%d + %d = ", x, y);
input = linenoise(prompt);
- if (strcmp(input, "q") == 0)
+ if ((!input) || (*input == '\0'))
{
free(input);
fclose(logfile);