diff --git a/headers/private/shared/Referenceable.h b/headers/private/shared/Referenceable.h index 9ed177bd70..27ddcd32a6 100644 --- a/headers/private/shared/Referenceable.h +++ b/headers/private/shared/Referenceable.h @@ -83,10 +83,12 @@ public: void SetTo(Type* object, bool alreadyHasReference = false) { + if (object != NULL && !alreadyHasReference) + object->AddReference(); + Unset(); + fObject = object; - if (fObject && !alreadyHasReference) - fObject->AddReference(); } void Unset()