i got nullreference

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

public class reudenListen : MonoBehaviour
{
public List pad;
public List<List> neighbours;
public List nodes;
double distanceSS;
double distanceES;
public List<List> paths;
public List marked;
Vector3 endStreet;
Vector3 startStreet;
int startIndex;
int endIndex;
int count;
public List starta;
public List shortestpath;

// Start is called before the first frame update
void Start()
{
    marked = new List<int>();
    starta = new List<int>();
    nodes = new List<Vector3>();
    pad = new List<Vector3>();
    paths = new List<List<int>>();
    neighbours = new List<List<int>>();
    startIndex = 1;
    count = 1;
    shortestpath = new List<int>();
}

// Update is called once per frame
void Update()
{
    distanceES = 1000000;
    distanceSS = 10000000;
}
public void updateGraph(Vector3 node)
{

    for (int i = 0; i < nodes.Count; i++)
    {
        if (Math.Pow(Math.Pow(node.x - nodes<em>.x, 2) + Math.Pow(node.y - nodes_.y, 2) + Math.Pow(node.z - nodes*.z, 2), 0.5) < 450)*_</em>

{

neighbours*.Add(nodes.Count + 1);*
}
}
nodes.Add(node);
neighbours.Add(new List { });
}
public List findShortestPath(Vector3 startPos, Vector3 endPos)
{
count = 1;

for (int i = 0; i < nodes.Count; i++)
{
if (distanceES > Math.Pow(Math.Pow(nodes.x - startPos.x, 2) + Math.Pow(nodes_.y - startPos.y, 2) + Math.Pow(nodes*.z - startPos.z, 2), 0.5))
{
distanceES = Math.Pow(Math.Pow(nodes.x - startPos.x, 2) + Math.Pow(nodes.y - startPos.y, 2) + Math.Pow(nodes.z - startPos.z, 2), 0.5);
endIndex = i;
}
if (distanceSS > Math.Pow(Math.Pow(nodes.x - startPos.x, 2) + Math.Pow(nodes.y - startPos.y, 2) + Math.Pow(nodes.z - startPos.z, 2), 0.5))
{
distanceSS = Math.Pow(Math.Pow(nodes.x - startPos.x, 2) + Math.Pow(nodes.y - startPos.y, 2) + Math.Pow(nodes.z - startPos.z, 2), 0.5);
startIndex = i;
}
}
starta.Add(startIndex);
//print(starta);
paths.Add(starta);
marked.Add(startIndex);
for (int s = 0; s < nodes.Count; s++)
{
// für alle Pfade*

for (int j= 0; j < paths.Count; j++)
{
//int amount = neighbours[paths[j][paths[j].Count - 1][0]];
print((paths[j].Count));
if (paths[j].Count > 0)
{
print(paths[j][paths[j].Count - 1]);
}
int value = neighbours[paths[j][paths[j].Count]].Count;
print(value);
//werden für alle nachbarn vom letzten element im pfad
// for (int k= 0; k < neighbours[paths[j].Count].Count; k++)
for (int k = 0; k < value; k++)
{//geschaut ob sie markiert sind
for (int l= 0; l < marked.Count; l++)
{
//print(neighbours.Count);
print(neighbours[paths[j][paths[j].Count - 1]]);
if (neighbours[paths[j][paths[j].Count-1]][k] == 2)
{
break;
}
if (neighbours[paths[j][paths.Count - 1]][k] == endIndex)
{
paths[j].Add((neighbours[paths[j][paths.Count - 1]][k]));
shortestpath = (paths[j]);
break;
}
}
marked.Add(k);
print(“komme ich her”);
paths[j].Add((neighbours[paths[j][paths.Count - 1]][k]));
}
}
}
for (int i = 0; i < shortestpath.Count; i++)
{
pad.Add(nodes*);*
}
foreach(Vector3 elem in pad)
{
print(elem);
}
print(pad);
return pad;_

}
public List returnNeighbours(int index) {

return neighbours[index];
}
}
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at :0)
reudenListen.findShortestPath (UnityEngine.Vector3 startPos, UnityEngine.Vector3 endPos) (at Assets/reudenListen.cs:94)
spawner.Update () (at Assets/spawner.cs:200)

What line is it? You are accessing an index that does not exist.

If you have a List with 3 elements and you try to access list[5] you get that error.