WeakReferenceable: Return NULL in GetReference if the pointer is gone.
Fixes a major API footgun that caused #18759.
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user