making an "if gameobject is still in scene" statement

hey all, so im just doing a bit of debugging and one ive come across is an error like this

“The object of type ‘GameObject’ has been destroyed but you are still trying to access it.”

now the line in question to this error is this >

        transform.position = Vector3.Lerp(transform.position, target.transform.position + new Vector3(-distance, distance, -distance), 0.5f * Time.deltaTime);

now i realise that the script is trying to access my main gameobject but cant because it was deleted, my question is what statement would i need to say “if gameobject exists”.

thankyou

How about:

var go = target.gameObject;
if (go == null)
  print ("target is destroyed, no longer exists");
else 
  print ("IT'S ALIVE!");