I’m finding that GetBrainComponent() returns NULL but I don’t know much about this component or why it would be NULL. What determines where it gets set and how is this component used in the big picture?
Your best bet is to go dig that yourself in the source code; it’s a great exercise and you will always find that you need to deal with similar problems in most C++ projects. We could go dig the source code for you, but you’re going to miss a lot of information and might not get the idea right.
According to the AIController’s source code, it only set BrainComponent when using a Behavior Tree via the RunBehaviorTree method. In that case, the BrainComponent will be an instance of UBehaviourTreeComponent.
You are just reporting what I’ve written in my answer. Anyway, I think we should wait for an official answer from someone at epic, in my opinion it sounds very strange that this component is initialized only via Blueprint.