MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it

How do I fix this error?

MissingReferenceException: The object of type ‘Transform’ has been destroyed but you are still trying to access it

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class UIManager : MonoBehaviour
{
    [SerializeField] Text _ammoText;

    public void UpdateAmmo(int count)
    {
        _ammoText.text = "Ammo: " + count;
    }

    void Update()
    {
        if(Input.GetKeyDown(KeyCode.Q))
        {
            SceneManager.LoadScene("mainy");
        }
    }

}

None of this code accesses a Transform, so it could not be missing. Please look at the stack trace and assess what you’ve done incorrectly in regards to the code it’s referencing and how to solve for a MissingReferenceException.