Prevents shader crash if two struct with the same name are declared

This commit is contained in:
Yuri Roubinsky 2021-02-21 13:45:01 +03:00 committed by Lyuma
parent ac547031d5
commit 2d1f8f2352

View file

@ -5608,6 +5608,10 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &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 '{'");