Skip to content

Commit

Permalink
Prevents shader crash if two struct with the same name are declared
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosus authored and lyuma committed May 14, 2021
1 parent ac54703 commit 2d1f8f2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions servers/visual/shader_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 '{'");
Expand Down

0 comments on commit 2d1f8f2

Please sign in to comment.