From a2c419bdc9db76666a9c9a7b6e50e6a0d1e33d55 Mon Sep 17 00:00:00 2001 From: Florian Kothmeier Date: Tue, 6 Oct 2020 23:22:25 +0200 Subject: [PATCH] Raise error if Resource is of wrong type as function argument --- core/variant/binder_common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/variant/binder_common.h b/core/variant/binder_common.h index 86bbf432660..830e0a5cbd5 100644 --- a/core/variant/binder_common.h +++ b/core/variant/binder_common.h @@ -122,6 +122,18 @@ struct VariantObjectClassChecker { } }; +template +class Ref; + +template +struct VariantObjectClassChecker &> { + static _FORCE_INLINE_ bool check(const Variant &p_variant) { + Object *obj = p_variant; + const Ref node = p_variant; + return node.ptr() || !obj; + } +}; + template <> struct VariantObjectClassChecker { static _FORCE_INLINE_ bool check(const Variant &p_variant) {