FindWithTag error

Hi everyone, I am trying to use FindWithTag to search for all of the enemies on the screen with tag “enemy”. The script works fine and it finds all of them, however if all enemies are destroyed, the script sends me an error message saying “NullReference…”, and I have no idea how to fix it :(. I did try using GameObject instead of Transform and it works fine, however later in the script I am trying to use the LookAt which needs “Transform” and gives me error. It doesn’t matter which way I go, it will give me an error, which I cant fix myself.
Do you have any idea how to fix it?
The code:

var target : Transform;
var boltSpeed : float = 10;
function Update() 
{
if(!target)
{
	var TempSearch = GameObject.FindWithTag("enemy").transform;
	if(!TempSearch) 
	{ 
		Destroy(gameObject, 0.01);
		print("dead");
	}
	else if(TempSearch)
	{
		target = TempSearch;
	}
}
else if(target)
	{
		transform.LookAt(target);
		if(gameObject.transform.position != target.transform.position)
		{
			gameObject.transform.Translate(Vector3.forward * boltSpeed * Time.deltaTime);
		} 
	}
}

The error message:

Uploaded with ImageShack.us

var TempSearch = GameObject.FindWithTag("enemy").transform;

Isn't Right, Use this:

var target : GameObject; var boltSpeed : float = 10; function Update() { if(!target) { var TempSearch = GameObject.FindWithTag("enemy"); if(!TempSearch) { Destroy(gameObject, 0.01); print("dead"); } else if(TempSearch) { target = TempSearch; } } else if(target) { transform.LookAt(target.transform); if(gameObject.transform.position != target.transform.position) { gameObject.transform.Translate(Vector3.forward * boltSpeed * Time.deltaTime); } } }