Weird UnassignedReferenceException bug

Hi, I found a very weird bug.
If i do this

void Update () {
		if(p2!=null)
		{
			Debug.Log("p2 exsists");
			Debug.Log(p2.transform.position);
		}
	}

then it runs and prints the position out

if i then drop the test and do this

 void Update () {
    Debug.Log(p2.transform.position);
    	}

then it still prints out the position but it also puts out the UnassignedReferenceException error twice per frame.

Nothing else is changed and the gameobject p2 is a public variable and assigned in the inspector

Very sorry, i was making a dumb error.
I duplicated the object with the script. So there were two objects with the script and only one had p2 assigned. Didnt see that.
Again, apologies

regards