Setting an object reference to null

I have a reference to a gameObject. At the start of the game it is null - during the game it is assigned to different gameObjects as needed. I wan to be able to test if it is null or set to whatever gameObject. The problem is I get an error ‘Object reference not set to an instance of an object’ when it is null. Why cant I have a null object reference?

as mentioned in the comments you can run an if statement or you can do something like the example below

GameObject tempGO = new GameObject();
GameObject yourGO = new GameObject();


void Start()
{
tempGO.tag = "tempGO"; //in case you need to check the gameobject by tag
}

void Update()
{
//assign your gameobject here
//when you unassign it you can use
yourGo = tempGo;
//this way the gameObject will never be null
}