NullReferenceExeption

Hello friends,

can someone help me please?
I have a script called Arrow wich holds the setttings of the arrow.
There are multiple arrow gameobject in the scene.

I have another script called PlayerControl. with a array called arrows of type GameObject
I created a list direction for the direction with can be set in the arrow script.

To get the direction i wanted to do this in PlayerControl:

private void Start()
{
        foreach (GameObject arrow in arrows)
        {
              Debug.Log("foreach called");
              string direction = arrow.GetComponent<Arrow>().direction;

              directions.Add(direction);
        }
  }

But when i want to try this i got the following error:
NullReferenceException: Object reference not set to an instance of a object
(assests/Playercontrol.cs:19)

Which is this line:
directions.Add(direction);

I do not understand what the mistake is cause string direction is set.

greetz

Solved:

Added directions = new list(); to the start function