Not sure what this error is telling/asking me to do?

I watched a video on an interaction script (because I suck at scripting), and I did all according to plan. However, I get this error message “NullReferenceException: Object reference not set to an instance of an object Interact.Update() (at Assets/Interact.cs:50)” and i have no idea what it is telling me to do in order to fix it.

My code:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Interact : MonoBehaviour
{
    public string interactButton;

    public float InteractDistance = 3f;
    public LayerMask interactLayer; //filter

    public Image interactIcon; //Picture to show if you can interact or not

    public bool isInteracting;

	// Use this for initialization
	void Start ()
    {
        //set interact icon to be invisible
        if(interactIcon != null)
        {
            interactIcon.enabled = false;
        }
	}
	
	// Update is called once per frame
	void Update ()
    {
        Ray ray = new Ray(transform.position, transform.forward);
        RaycastHit hit;

        //Shoots a ray
        if(Physics.Raycast(ray, out hit, InteractDistance, interactLayer))
        {
            //Checks if we are not interacting
            if (isInteracting == false)
            {
                if(interactIcon != null)
                {
                    interactIcon.enabled = true;
                }

                //If we press the interaction button
                if (Input.GetButtonDown("Interact"))
                {
                    //If it is a Door
                    if (hit.collider.CompareTag("Door"))
                    {
                        //Open or Close it
                        hit.collider.GetComponent<Door>().ChangeDoorState();
                    }
                }
            }
        }
	}
}

Line 50 = hit.collider.GetComponent().ChangeDoorState();

I thought it was telling me to name the gameobject “Door” but i guess thats not the issue :frowning:
Thanks!

The object that the Ray cast hit does not have a door component. Try using Debug.Log to print out the value of hit.collider and hit.collider.gameObject to make sure you are hitting the object you expect, and make sure there is a Door component in that object.