This tutorial is misleading. We cannot attach components to uninitialized AActor::RootComponent

As by default AActor::GetRootComponent() returns NULL, the body of the if construct will never be executed (the condition is always false). As a result the actor will not work as the tutorial expects.

The proper approach is instantiating a component and set it as the root component.
The if construct is not needed at all.