From 2d1f8f2352f3e36f9d8ddb31b1a32033352f5268 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Sun, 21 Feb 2021 13:45:01 +0300 Subject: [PATCH] Prevents shader crash if two struct with the same name are declared --- servers/visual/shader_language.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 8f55f39e064..9f52222ac55 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -5608,6 +5608,10 @@ Error ShaderLanguage::_parse_shader(const Map &p_funct tk = _get_token(); if (tk.type == TK_IDENTIFIER) { st.name = tk.text; + if (shader->structs.has(st.name)) { + _set_error("Redefinition of '" + String(st.name) + "'"); + return ERR_PARSE_ERROR; + } tk = _get_token(); if (tk.type != TK_CURLY_BRACKET_OPEN) { _set_error("Expected '{'");