HELP: Object reference not set to an instance of an object

Hi guys ! I’ve scripted a simple code to destroy a wall :smiley: It work, but when i destroy the wall unity tell me this error: Object reference not set to an instance of an object…
This is the script:

  using UnityEngine;
  using System.Collections;

  public class DestroyableObject : MonoBehaviour 
  {
void OnTriggerEnter (Collider other)
{
	if (other.gameObject.GetComponent<PlayerController>().wall == true) 
	{
		Destroy (gameObject);
	}

}
 }

Please help me !

Should check if the component exists on the gameObject first.

if (other.gameObject.GetComponent<PlayerController>() != null)
{
     if (other.gameObject.GetComponent<PlayerController>().wall == true) 
     {
         Destroy (gameObject);
     }
}