My TArray of one structure works when declared inside a function, but not when declared on header file

Calling the function from blueprints works just fine, calling the function using c++ results in the crash, tried using the function from other actor and it crashs anyway.