diff --git a/cv1/program.c b/cv1/program.c index ce7f787..24bb1b2 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -64,11 +64,14 @@ int main() { int count = 0; printf("Zadaj hladanu surovinu:\n"); - fgets(search, LINESIZE, stdin); + if (!fgets(search, LINESIZE, stdin)) { + printf("Error reading input.\n"); + return 1; + } search[strcspn(search, "\n")] = '\0'; printf("Zadaj jedalny listok:\n"); - while (read_pizza(&menu[count])) { + while (count < MENU_SIZE && read_pizza(&menu[count])) { count++; }