object reference not set to an instance of an object

Can anyone help me figure out why this is happening? ive been beating my head against my desk for hours now.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
using RPG.Combat;

namespace RPG.Control
{
public class AiController : MonoBehaviour
    {
        [SerializeField] float chaseDistance = 5.0f;
        [SerializeField] float distanceFromPlayer;
        Transform target;
        [SerializeField] float moveSpeed;
        NavMeshAgent navMeshAgent;
        [SerializeField] float bufferDistance = 2.0f;

        Fighter fighter;
        GameObject player;        private void Start()
        {
            fighter = GetComponent<Fighter>();
            GameObject player = GameObject.FindWithTag("Player");
        }

        private void Update()
        {
            if(!InAttackRangeOfPlayer() || !fighter.CanAttack(player)) return;
           
          if(InAttackRangeOfPlayer() && fighter.CanAttack(player))
          {
              fighter.Attack(player);
              float distanceFromPlayer = Vector3.Distance(player.transform.position, transform.position);
          }

    
      }

      private bool InAttackRangeOfPlayer()
      {
          float distanceFromPlayer = Vector3.Distance(player.transform.position, transform.position);
          return distanceFromPlayer < chaseDistance;
      }
          



        }
       

    }

Copy and paste the error here, please. It has more information with it (specifically the line number).

NullReferenceException: Object reference not set to an instance of an object
RPG.Control.AiController.Update () (at Assets/Scripts/AiController.cs:29)

my bad, forgot this.

OK, so your “fighter” variable is clearly null. You set that with .GetComponent, so is there a Fighter script attached to the same object as this script?

No there is not. im drawing out all my dependencies at the moment to see where this link might be get messed up.

Im a fairly new programmer, why would my fighter value return null?

Holy shit im stupid. Obviously it returned Null because theres nothing for it to reference on the game object. id forgotten to add the required scripts in when i remade my prefabs. I need to goto sleep. Thanks bro. youre a champ.