Add the 'Object::IsNull' check in Transform.cpp to avoid crashes related to invalid pointers.

This commit is contained in:
KnucklesB
2024-07-19 18:46:21 -03:00
parent d3240f614b
commit e6f6b82546

View File

@@ -1,11 +1,11 @@
#include "pch-il2cpp.h"
#include "UnityEngine/Transform.h"
#include <UnityEngine/Object.h>
app::Transform* Transform::GetTransform(app::GameObject* go)
{
if (!go || !app::GameObject_get_transform) return nullptr;
if (Object::IsNull(reinterpret_cast<app::Object_1*>(go)) || !app::GameObject_get_transform) return nullptr;
app::Transform* __transform = app::GameObject_get_transform(go, nullptr);
return __transform ? __transform : nullptr;