Cant get rid of log spam UnassignedReferenceException.

This code does what i want in game. But the log is spammed with UnassignedReferenceException for target. I have no idea why. I tried searching and reading to learn what is wrong but cant figure it out. Can someone please take a look?

using UnityEngine;
using System.Collections;

public class WarriorController : MonoBehaviour {

	public GameObject goal;
	NavMeshAgent agent;
	public GameObject target;

	public bool stopNavigation = false;

	// Use this for initialization
	void Start () 
	{
		goal = GameObject.Find ("Waypoint");

	
	}
	
	// Update is called once per frame
	void Update () 
	{
		
		if (target) {
			transform.GetComponent<NavMeshAgent> ().Stop ();
			} 

		if (stopNavigation == false) {
			NavMeshAgent agent = GetComponent<NavMeshAgent> ();
			agent.destination = goal.transform.position;
		}



		
			if (Vector3.Distance (target.transform.position, this.transform.position) < 10) {
				Vector3 direction = target.transform.position - this.transform.position;

				this.transform.rotation = Quaternion.Slerp (this.transform.rotation, Quaternion.LookRotation (direction), 0.1f);

		}
			
			
		
	}


	void OnTriggerEnter(Collider other)
	{
		if (other.gameObject.tag == "team2") {
			//this.transform.LookAt(other.gameObject.transform);
			stopNavigation = true;
			target = other.gameObject;

		}

	}
		
}

The following code does not check whether target has a valid value:

if (Vector3.Distance (target.transform.position, this.transform.position) < 10) {
    Vector3 direction = target.transform.position - this.transform.position;
     this.transform.rotation = Quaternion.Slerp (this.transform.rotation, Quaternion.LookRotation (direction), 0.1f);
}

You could probably move that part up to where you stop the NavMeshAgent:

if (target) {
    transform.GetComponent<NavMeshAgent> ().Stop ();

    if (Vector3.Distance (target.transform.position, this.transform.position) < 10) {
        Vector3 direction = target.transform.position - this.transform.position;
        this.transform.rotation = Quaternion.Slerp (this.transform.rotation, Quaternion.LookRotation (direction), 0.1f);
    }
}