GDScript: don't allow calling non-static function from script

This commit is contained in:
George Marques 2019-01-17 16:19:12 -02:00
parent ba13aae9af
commit f4546fc0cd

View file

@ -642,7 +642,8 @@ Variant GDScript::call(const StringName &p_method, const Variant **p_args, int p
if (E) { if (E) {
if (!E->get()->is_static()) { if (!E->get()->is_static()) {
WARN_PRINT(String("Can't call non-static function: '" + String(p_method) + "' in script.").utf8().get_data()); ERR_EXPLAIN("Can't call non-static function: '" + String(p_method) + "' in script.");
ERR_FAIL_V(Variant());
} }
return E->get()->call(NULL, p_args, p_argcount, r_error); return E->get()->call(NULL, p_args, p_argcount, r_error);