Check if collided object doesn't have a script.

How do I check if the currently colliding object has a script called GoalBehavior and not newPlayer ?
Currently, I get a NullReferenceException when an object with the script GoalBehavior collides with the object.

void OnTriggerEnter (Collider obj)
	{
		if (obj.GetComponent<newPlayer>().isGhost == true)
		{
			gameover.SetActive(true);
		}
		else if (obj.GetComponent<GoalBehavior>().isGoal == true && isGhost == false)
		{
			gameObject.GetComponent<MeshRenderer>().material = ghostMat;
            }
   }

newPlayer nPlayer = obj.gameObject.GetComponent();

if(nPlayer != null){
 // obj has newPlayer component.
}

WUCC