Why am I not getting the right positions?

Hello. I’m following a video tutorial and one of the first steps is to get the position of some object that I’ve thrown into the level. So I’ve created a component which displays the name and position of the object and I attached it to every object on the level. Here is my code:

UPositionReport::UPositionReport()
{
	// Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
	// off to improve performance if you don't need them.
	bWantsBeginPlay = true;
	PrimaryComponentTick.bCanEverTick = true;

	
	if (GetOwner() != NULL) {
		FString ObjectName = GetOwner()->GetName();
		FString ObjectPos = GetOwner()->GetTransform().GetLocation().ToString();
            //FString ObjectPos = GetOwner()->GetActorLocation().ToString();
		UE_LOG(LogTemp, Warning, TEXT("%s at position %s"), *ObjectName, *ObjectPos);
	}
	else {
		UE_LOG(LogTemp, Warning, TEXT("GetOwner() is NULL"));
	}	
}

When I run the game I’m getting the names of the objects in the console but the positions are all X=0.000, Y=0.000, Z=0.000. The commented code isn’t also producing the expected results. Why is this happening?

Also the instructor is able to run this piece of code without checking if GetOwner != NULL and it works, while my editor crashes whenever I don’t put the check, any ideas for that?