diff --git a/cv7/program.c b/cv7/program.c index 266a371..5b330c1 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -32,10 +32,16 @@ struct tree* load_tree() { if (node->value[0] != '*') { node->left = load_tree(); node->right = load_tree(); + + if (!node->left || !node->right) { + destroy_tree(node); + return NULL; + } } return node; } + void run_tree(struct tree* tree) { if (!tree) { return;