summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorFlorian Kothmeier <floriankothmeier@web.de>2020-10-06 23:22:25 +0200
committerFlorian Kothmeier <floriankothmeier@web.de>2021-04-27 21:24:08 +0200
commita2c419bdc9db76666a9c9a7b6e50e6a0d1e33d55 (patch)
tree186dd23e1694a4b1dbcfee0aae968a6ac81318d2 /core
parent0582cefcbb6c4dc0f5d36000f39c627ecf5f9b70 (diff)
Raise error if Resource is of wrong type as function argument
Diffstat (limited to 'core')
-rw-r--r--core/variant/binder_common.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/variant/binder_common.h b/core/variant/binder_common.h
index 86bbf43266..830e0a5cbd 100644
--- a/core/variant/binder_common.h
+++ b/core/variant/binder_common.h
@@ -122,6 +122,18 @@ struct VariantObjectClassChecker {
}
};
+template <typename T>
+class Ref;
+
+template <typename T>
+struct VariantObjectClassChecker<const Ref<T> &> {
+ static _FORCE_INLINE_ bool check(const Variant &p_variant) {
+ Object *obj = p_variant;
+ const Ref<T> node = p_variant;
+ return node.ptr() || !obj;
+ }
+};
+
template <>
struct VariantObjectClassChecker<Node *> {
static _FORCE_INLINE_ bool check(const Variant &p_variant) {