From b85096463edc819953987b305e3571a8a770fe8c Mon Sep 17 00:00:00 2001 From: Xavier Sellier Date: Tue, 14 Jan 2025 12:52:40 +0100 Subject: [PATCH] Fix crash when using a modulo operator between a float and an integer --- modules/gdscript/gdscript_byte_codegen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp index 122e9cb4bad..77e6d98a7b8 100644 --- a/modules/gdscript/gdscript_byte_codegen.cpp +++ b/modules/gdscript/gdscript_byte_codegen.cpp @@ -591,7 +591,8 @@ void GDScriptByteCodeGenerator::write_binary_operator(const Address &p_target, V if (valid && (p_operator == Variant::OP_DIVIDE || p_operator == Variant::OP_MODULE)) { switch (p_left_operand.type.builtin_type) { case Variant::INT: - valid = p_right_operand.type.builtin_type != Variant::INT; + // Cannot use modulo between int / float, we should raise an error later in GDScript + valid = p_right_operand.type.builtin_type != Variant::INT && p_operator == Variant::OP_DIVIDE; break; case Variant::VECTOR2I: case Variant::VECTOR3I: