diff --git a/src/ast/expressions/if_then_else.cpp b/src/ast/expressions/if_then_else.cpp index b597c3b..77a40b3 100644 --- a/src/ast/expressions/if_then_else.cpp +++ b/src/ast/expressions/if_then_else.cpp @@ -23,8 +23,11 @@ namespace ast { }; if_then_else::~if_then_else() { - delete condition; - delete consequence; - delete alternative; + if (condition != nullptr) + delete condition; + if (consequence != nullptr) + delete consequence; + if (alternative != nullptr) + delete alternative; } } // namespace ast