Help with MissingReferenceException error

getting massive error MissingReferenceException: The object of type ‘Transform’ has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.

i have a script that makes my character make soldiers and the soldiers attack the problem is
when they kill the enemy they have no target and it give an error every frame causing the game to break i need a line of code to teel it if theres no target do nothing

HERE IS THE SOLDIER AI SCRIPT

public var target:Transform;
public var moveSpeed:int;
public var rotationSpeed:int;
public var maxDistance:int;
public var GForce :int=200; 
private var myTransform:Transform;


function Awake(){
myTransform = transform;
}

function Update(){Physics.gravity = Vector3.down* GForce*Time.deltaTime;

GameObjectgo = GameObject.FindGameObjectWithTag("Enemy");


target=GameObjectgo.transform;

		maxDistance = 2;



Debug.DrawLine (target.transform.position, myTransform.position, Color .yellow);



		myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);
		
		if(Vector3.Distance(target.position, myTransform.position) > maxDistance) {
	 
	myTransform.position += myTransform.forward *moveSpeed *  Time.deltaTime;
	}
}

AND THE IS THE SOLDIER ATTACK SCRIPT

//select a target in editor
 public var target:Transform;
   //how much time before we can attack again
   public var attackTimer:float;
   //how much time before we can attack again
   public var cooldown:float;  
 
// Use this for initialization
function Start () {
       attackTimer = 2;
       cooldown = 2.0f;
 
 
 
 
 
 GameObjectgo = GameObject.FindGameObjectWithTag("Enemy");

target=GameObjectgo.transform;
}
 
// Update is called once per frame
function Update () {
     if(attackTimer > 0)
         attackTimer -= Time.deltaTime;
 
          if(attackTimer < 0)
             attackTimer =0;
 
     
       if(attackTimer ==0) {
       Attack();
 
         attackTimer = cooldown;
       }
    }


 private function Attack() {
var distance : float  = Vector3.Distance(target.transform.position, transform.position);
 
var dir:Vector3  = (target.transform.position - transform.position).normalized;
 
var direction : float  = Vector3.Dot(dir, transform.forward);
 
 
 
 if(distance < 2.5f) {
        if(direction >0) {
       var EnemyHealthbareh :EnemyHealthbar ;
       EnemyHealthbareh = target.GetComponent(EnemyHealthbar);
EnemyHealthbareh.AddjustCurrentHealth(-10);
 }
 }
 
 }

It basically tells you what to do…put everything after you get your enemy game object in an if statement like this:

if(GameObjectgo != null){

     // Do everything else

}