This commit is contained in:
Ivan Leichenko 2024-11-15 07:11:55 +01:00
parent ef5fd01176
commit 31cd3999f2

View File

@ -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)