summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp
diff options
context:
space:
mode:
authorDNKpp <dnkpp2011@gmail.com>2022-07-26 00:41:57 +0200
committerDNKpp <dnkpp2011@gmail.com>2022-07-26 00:41:57 +0200
commit95574c1b11da362c427d6331c74c672bb001844e (patch)
tree6b53ee63cb3043cb90c1e213bcb5dbab32697172 /include/godot_cpp
parent3cc14092104c0cf9cc617824f5d85c2fcaf0e838 (diff)
downloadredot-cpp-95574c1b11da362c427d6331c74c672bb001844e.tar.gz
fix: Object::cast_to checks provided object for nullptr
Diffstat (limited to 'include/godot_cpp')
-rw-r--r--include/godot_cpp/core/object.hpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/godot_cpp/core/object.hpp b/include/godot_cpp/core/object.hpp
index 6b1bed9..df2ef25 100644
--- a/include/godot_cpp/core/object.hpp
+++ b/include/godot_cpp/core/object.hpp
@@ -169,6 +169,9 @@ public:
template <class T>
T *Object::cast_to(Object *p_object) {
+ if (p_object == nullptr) {
+ return nullptr;
+ }
GDNativeObjectPtr casted = internal::gdn_interface->object_cast_to(p_object->_owner, internal::gdn_interface->classdb_get_class_tag(T::get_class_static()));
if (casted == nullptr) {
return nullptr;