diff --git a/src/tinyexpr.cpp b/src/tinyexpr.cpp index fe226781d..1d0d7bcc5 100644 --- a/src/tinyexpr.cpp +++ b/src/tinyexpr.cpp @@ -586,7 +586,7 @@ double te_eval(const te_expr *n) { static void optimize(te_expr *n) { /* Evaluates as much as possible. */ - if (n->type == TE_CONSTANT) return; + if (!n || n->type == TE_CONSTANT) return; const int arity = get_arity(n->type); bool known = true;