New Input System - Strange Missing Reference Exception on Exit

Hi All,
I’ve been learning the new input system for my latest project and I have come to a strange exception error whenever the game stops or I switch scenes. Now it doesn’t appear to actually cause any issues, but I dislike errors I don’t fully understand and I fear it may cause issues down the line.

so the setup is fairly basic,I have an Action Map setup named cursor_actions and an Action named Movement set to Pass Through and Stick. I have an inputManager object and class which has the basic code for input:

using UnityEngine.InputSystem;

public class InputManager : MonoBehaviour, Input_actions.ICursor_actionsActions
{
    private Input_actions controls;

    private void Awake()
    {
        controls = new Input_actions();
        controls.cursor_actions.SetCallbacks(this);
    }

    private void OnEnable() { controls.Enable(); }
    private void OnDisable() { controls.Disable(); }


    public void OnMovement(InputAction.CallbackContext context)
    {
        switch (context.phase)
                {
                    case InputActionPhase.Performed:
                        Vector2 leftStickInputforCursor = context.ReadValue<Vector2>();
                        cursorVelocity = new Vector3(leftStickInputforCursor.x * cursorSpeed, 0, leftStickInputforCursor.y * cursorSpeed);
                        break;
                    case InputActionPhase.Canceled:
                        cursorVelocity = Vector3.zero;
                        break;
                }
    }

I omitted the movement code because the error seems to appear regardless. everything works just fine, but when I move to a new scene or a stop the game this exception appears:

MissingReferenceException while executing 'canceled' callbacks of 'cursor_actions/Movement[/XInputControllerWindows/leftStick]'
UnityEngine.InputSystem.InputActionAsset:smile:isable()
Input_actions:smile:isable() (at Assets/Input/input_actions.cs:217)
InputManager:OnDisable() (at Assets/Scripts/Monobehaviors/InputManager.cs:26)

and also:

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.GameObject.GetComponent[T] () (at <d815b7efac424eeb8e053965cccb1f98>:0)
InputManager.OnMovement (UnityEngine.InputSystem.InputAction+CallbackContext context) (at Assets/Scripts/Monobehaviors/InputManager.cs:70)
UnityEngine.InputSystem.Utilities.DelegateHelpers.InvokeCallbacksSafe[TValue] (UnityEngine.InputSystem.Utilities.InlinedArray`1[System.Action`1[TValue]]& callbacks, TValue argument, System.String callbackName, System.Object context) (at Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Utilities/DelegateHelpers.cs:51)
UnityEngine.InputSystem.InputActionAsset:smile:isable()
Input_actions:smile:isable() (at Assets/Input/input_actions.cs:217)
InputManager:OnDisable() (at Assets/Scripts/Monobehaviors/InputManager.cs:26)

It looks like the input system’s callback is still firing AFTER unity has deleted my InputManager object or something. I’m a bit confused here because how can I check if itself is null before using it? lol I am probably not understanding the error correctly here, or that I am simply not using the system correctly or I am missing either a null check or not cleaning up my scene properly when it unloads and loads a new scene.

Any help here to understand this error and why it’s occurring would be helpful. Thanks.

I seem to have resolved the issue. I was looking at it the wrong way, I was assuming that the deleted object that was being referenced was the inputManager class but was in fact another object I was referencing from within one of the Callback context functions.