Adding to SubObject list in Constructor causing reference exception

I’m following this guide on SubObject replication, but I ran into this issue that I’m not understanding

The guide says to add the following to the Actor’s constructor

     if(IsValid(MyActorSubobject))
     {
         RemoveReplicatedSubObject(MyActorSubobject);
     }
 
     MyActorSubobject = NewObject<UMyObject>();
     MyActorSubobject->ReplicatedValue = 1;
 
     // MyActorSubobject becomes a replicated subobject here 
     AddReplicatedSubObject(MyActorSubobject);

however it causes a null reference when calling AddReplicatedSubObject(MyActorSubobject)

My understanding of this code is that if the SubObject is valid, it removes it from the replicated subobject list before executing the rest

Then it creates an instance of the UMyObject subobject and assigns it to MyActorSubobject,

Finally it adds the newly assigned subobject to the replicated subobject list

How is there room for a null here?

havent tried it myself but just lower it says

If you want to construct your subobject directly in your actor’s constructor, use AActor::CreateDefaultSubobject instead of AActor::NewObject. To learn more about object creation in UE, see the UObject Creation documentation.

i think NewObject could fail on the construction because it may not have a valid world/outer etc?