WeakReferenceable: Return NULL in GetReference if the pointer is gone.

Fixes a major API footgun that caused #18759.
This commit is contained in:
Augustin Cavalier
2024-03-14 17:15:59 -04:00
parent 45bd581b70
commit 776d091d8a
@@ -170,6 +170,9 @@ public:
BReference<Type> GetReference() BReference<Type> GetReference()
{ {
if (fPointer == NULL)
return BReference<Type>();
Type* object = static_cast<Type*>(fPointer->Get()); Type* object = static_cast<Type*>(fPointer->Get());
return BReference<Type>(object, true); return BReference<Type>(object, true);
} }