Index was out of range when a GameObject goes offscreen... HELP!

I’m getting the index was out of range error whenever the current target is offscreen because of this script and I’m not sure why. Can someone out there please tell me how to fix this? Thanks!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class targetingSystemV2 : MonoBehaviour
{
    public GameObject currentTarget;
    public int currentTargetId;
    public List<GameObject> listOfTargets = new List<GameObject>();

    void Update()
    {
        if(listOfTargets.Count > 0 && listOfTargets[currentTargetId] != null)
        {
            

            currentTarget = listOfTargets[currentTargetId];

        }
        else
        {
            currentTarget = null;
        }


    }

    void OnTriggerEnter2D(Collider2D col)
    {
        if(col.gameObject.tag == "Target")
        {
            listOfTargets.Add(col.gameObject);
        }
    }

    void OnTriggerExit2D(Collider2D col)
    {
        listOfTargets.Remove(col.gameObject);
    }
}

I’m guessing the trigger is the view of the camera right. My guess would be that OnTriggerExit2D isn’t checking if the object has a tag of “Target” and hence any object leaving the trigger would try to remove itself from the list whether it’s a target or not. So try adding a tag check to the OnTriggerExit2D