diff --git a/include/godot_cpp/core/method_ptrcall.hpp b/include/godot_cpp/core/method_ptrcall.hpp index ea18788..2812755 100644 --- a/include/godot_cpp/core/method_ptrcall.hpp +++ b/include/godot_cpp/core/method_ptrcall.hpp @@ -169,7 +169,7 @@ struct PtrToArg { } typedef Object *EncodeT; _FORCE_INLINE_ static void encode(T *p_var, void *p_ptr) { - *((void **)p_ptr) = p_var->_owner; + *((void **)p_ptr) = p_var ? p_var->_owner : nullptr; } }; @@ -180,7 +180,7 @@ struct PtrToArg { } typedef const Object *EncodeT; _FORCE_INLINE_ static void encode(T *p_var, void *p_ptr) { - *((void **)p_ptr) = p_var->_owner; + *((void **)p_ptr) = p_var ? p_var->_owner : nullptr; } };