Null Ref Exception on Tag of Parent Transform

I have a coroutine that climbs a tree of game objects (cats actually) and sends a message to each cat in the chain.

When I try to access the tag of the parent transform I get a null ref exception:

	IEnumerator StartCatWave() {
		Transform trans = transform.parent;
		if(trans == null)
			StopCoroutine("StartCatWave()");
		print (trans.tag);
		while(trans.tag == "kitty") {
			trans.gameObject.SendMessage("CatWave",c_);
			trans = trans.parent;
			yield return new WaitForSeconds(.15f);
		}
	}

NullReferenceException
Kitty+c__Iterator7.MoveNext () (at Assets/Scripts/Game Objects/Kitty.cs:28)
UnityEngine.MonoBehaviour:StartCoroutine(String)
Kitty:OnCollisionEnter(Collision) (at Assets/Scripts/Game Objects/Kitty.cs:150)

Not entirely sure what’s going on, code seems fine to me and this is the only place I mess with these references.

I think you want to use ‘yield break;’ instead of ‘StopCoroutine()’:

IEnumerator StartCatWave() {
   Transform trans = transform.parent;
   if(trans == null)
     yield break;
   print (trans.tag);
   while(trans.tag == "kitty") {
     trans.gameObject.SendMessage("CatWave",c_);
     trans = trans.parent;
     yield return new WaitForSeconds(.15f);
   }
}