From d8b36a452c83cf99befe3011ccf19bc0310bc387 Mon Sep 17 00:00:00 2001 From: Patrick Wuttke Date: Mon, 7 Oct 2019 12:05:39 +0200 Subject: [PATCH] check for cyclic inheritance when adding a global class --- core/script_language.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/core/script_language.cpp b/core/script_language.cpp index 7201773ea5d..cbe4681ecab 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -218,6 +218,7 @@ void ScriptServer::global_classes_clear() { } void ScriptServer::add_global_class(const StringName &p_class, const StringName &p_base, const StringName &p_language, const String &p_path) { + ERR_FAIL_COND_MSG(p_class == p_base || (global_classes.has(p_base) && get_global_class_native_base(p_base) == p_class), "Cyclic inheritance in script class."); GlobalScriptClass g; g.language = p_language; g.path = p_path;