diff --git a/cv8/program.c b/cv8/program.c index 2d9dfb2..c52097e 100644 --- a/cv8/program.c +++ b/cv8/program.c @@ -17,7 +17,10 @@ struct tree* read_tree(){ int x = strlen(buffer); buffer[x-1]='\0'; - assert(r); + if(r == NULL){ + printf("Chybna databaza\n"); + exit(0); + } if(buffer[0] != '\0'){ struct tree* node = calloc(1,sizeof(struct tree)); @@ -132,12 +135,14 @@ int count_all(struct tree* node){ int main(){ + + printf("Expert z bufetu to vie.\n"); + struct tree* tree = NULL; tree = read_tree(); int count = count_leaves(tree); - printf("Expert z bufetu to vie.\n"); printf("Pozna %d druhov ovocia a zeleniny.\n", count); printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n");