fixed infinite loop on incalid input

bugfix
ketrptr 2024-12-15 14:04:26 +01:00
parent 87c5fa8225
commit 7dfcf1500b
1 changed files with 6 additions and 2 deletions

View File

@ -33,10 +33,13 @@ int main(void) {
printf(" -5- Faecher Importieren\n");
printf(" -6- Planer beenden\n");
printf(" Wähle die gewünschte Option aus\n");
if (scanf("%d", &choice) != 1) {
volatile int r = scanf("%d", &choice);
if (r != 1) {
printf("Falsche Eingabe\n");
fgetc(stdin);
choice = 0;
continue;
};
// choice = 0;
switch (choice) {
case 1:
@ -95,6 +98,7 @@ int main(void) {
case 3:
if (listT == NULL) {
printf("Die Liste ist leer");
break;
} else {
llistPrintT(listT);
// llist *iterator = list;