From b0df0b46ac356f88639a6a195ab62fd1e6aaf57f Mon Sep 17 00:00:00 2001 From: santouits Date: Sun, 28 Oct 2018 12:13:39 +0200 Subject: [PATCH] Error running Expression.execute after parse error There happens a segmentation fault when you use Expression.parse() and you don't check for errors and then run Expression.execute(). So we check if there was a parse error in the execute method now. --- core/math/expression.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/math/expression.cpp b/core/math/expression.cpp index a16267cf0a7..0cfb54234c0 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -2120,6 +2120,10 @@ Error Expression::parse(const String &p_expression, const Vector &p_inpu } Variant Expression::execute(Array p_inputs, Object *p_base, bool p_show_error) { + if (error_set) { + ERR_EXPLAIN("There was previously a parse error: " + error_str); + ERR_FAIL_V(Variant()); + } execution_error = false; Variant output;