Checking if an object is null, results in NRE

void OnTriggerEnter(Collider col)
{
if (m.Target == null)
{
if (col.gameObject.tag == “Player”)
{
Debug.Log(“found player”);
m.Target = col.transform;
}
}
}

So I have this code where I want to set a player as a target as long as there is no target.
Target is a Transform.

The problem I have here is that it gives me NullReferenceExceptions on the check.

So what do you guys think as a possible solution. How to do this?

you need to be checking m for null too