From e9e21a592e5d7a001c37eeb0502f139775f858d0 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Wed, 22 Sep 2021 13:23:34 +0300 Subject: [PATCH] Prevents editor crash when compare with negative float in shader --- servers/rendering/shader_language.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 89537f8b7cd..d6f8fe85c99 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -5252,7 +5252,9 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons } #if DEBUG_ENABLED - if (check_warnings && HAS_WARNING(ShaderWarning::FLOAT_COMPARISON_FLAG) && (op == OP_EQUAL || op == OP_NOT_EQUAL) && expression[i - 1].node->get_datatype() == TYPE_FLOAT && expression[i + 1].node->get_datatype() == TYPE_FLOAT) { + if (check_warnings && HAS_WARNING(ShaderWarning::FLOAT_COMPARISON_FLAG) && (op == OP_EQUAL || op == OP_NOT_EQUAL) && + (!expression[i - 1].is_op && !expression[i + 1].is_op) && + (expression[i - 1].node->get_datatype() == TYPE_FLOAT && expression[i + 1].node->get_datatype() == TYPE_FLOAT)) { _add_line_warning(ShaderWarning::FLOAT_COMPARISON); } #endif // DEBUG_ENABLED