diff options
author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-05-31 23:23:17 +0900 |
---|---|---|
committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-05-31 23:23:17 +0900 |
commit | 0f951e2d72606854ce2689f201332f551a5a2b81 (patch) | |
tree | af1b054cfebc8e8a938cbcc1ac9f8de18de6ad49 /src | |
parent | 8a19837e71773af2405b6c4c64eeef0fbc9e3b22 (diff) |
Check user input before using it
Diffstat (limited to 'src')
-rw-r--r-- | src/calculer.c | 2 |
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); |