diff --git a/cv7/program.c b/cv7/program.c index 8b95c56..e779976 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -15,7 +15,7 @@ struct tree struct tree* read_tree() { char buffer[SIZE]; - if (!fgets(buffer, SIZE, stdin) || buffer[0] == '\n') + if (!fgets(buffer, SIZE, stdin) || buffer[0] == '\n' || buffer[0] == '\0') { return NULL; } @@ -136,6 +136,11 @@ void interact(struct tree *node, int fstenter) int main() { struct tree *root = read_tree(); + if(root == NULL) + { + printf("Chybna databaza\n"); + return 0; + } //getchar(); int leafs = count_leaf_nodes(root); if(leafs == 0)