1
0
Fork 0

Merge pull request #46275 from Chaosus/shader_fix_struct_crash

Prevents shader crash if two struct with the same name are declared
This commit is contained in:
Rémi Verschelde 2021-02-21 12:02:56 +01:00 committed by GitHub
commit b87f448785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -6135,6 +6135,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 '{'");