You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Prevents shader crash if two struct with the same name are declared
This commit is contained in:
@@ -5608,6 +5608,10 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
|||||||
tk = _get_token();
|
tk = _get_token();
|
||||||
if (tk.type == TK_IDENTIFIER) {
|
if (tk.type == TK_IDENTIFIER) {
|
||||||
st.name = tk.text;
|
st.name = tk.text;
|
||||||
|
if (shader->structs.has(st.name)) {
|
||||||
|
_set_error("Redefinition of '" + String(st.name) + "'");
|
||||||
|
return ERR_PARSE_ERROR;
|
||||||
|
}
|
||||||
tk = _get_token();
|
tk = _get_token();
|
||||||
if (tk.type != TK_CURLY_BRACKET_OPEN) {
|
if (tk.type != TK_CURLY_BRACKET_OPEN) {
|
||||||
_set_error("Expected '{'");
|
_set_error("Expected '{'");
|
||||||
|
|||||||
Reference in New Issue
Block a user