NullReferenceException: Object reference not set to an instance of an object

I’m making a platforming game where the ai use waypoints to move around. Each waypoint has other waypoints that the ai can easily reach. The WaypointScript is a script that all waypoints have where they give their waypoint number and an array of other waypoints they can lead to. However whenever I run the program an error pops up and says there’s a “NullReferenceException: Object reference not set to an instance of an object” at line 16. I’m assuming it’s refering to “canGo” but I don’t know how to get the object it’s from.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class WaypointScript : MonoBehaviour 
{
	public Transform[] canGo;
	public int number;
	public static int tracker = 1;
	public static List<Transform>[] allGoes = new List<Transform>[10];
	
	void Update()
	{
		if (number == tracker)
		{
			allGoes[tracker - 1].AddRange(canGo);
			tracker++;
		}
	}
}

Thanks in advance.

You allocate space for the allGoes array but it doesn’t look like you are allocating each of the individual elements. It might be simpler to move it to another class which can act as a singleton. Then you can initialise the elements of allGoes:

for (var i = 0; i < allGoes.Length; i++)
   allGoes *= new List<Transform>();*