Dangerous use of temp object

Hello,

At the very end of the lecture, you used this inline:

*GetOwner()->GetName()

Unless I’m missing something here, this is relying on undefined behaviour because the FString returned by GetName() is a temporary object, so by the time UE_LOG receives our const TCHAR*, the corresponding FString object no longer exists.

Privacy & Terms