Firstly, please read this post on how to post code in the forum.
You can reduce nesting by simply returning if player is null, like so;
private void FixedUpdate()
{
if (player == null)
return;
float posX = Mathf.SmoothDamp(transform.position.x, player.transform.position.x, ref velocity.x, smoothTimeX);
float posY = Mathf.SmoothDamp(transform.position.y, player.transform.position.y, ref velocity.y, smoothTimeY);
transform.position = new Vector3(posX, posY, transform.position.z);
if (bounds)
{
transform.position = new Vector3(Mathf.Clamp(transform.position.x, minCameraPos.x, maxCameraPos.x),
Mathf.Clamp(transform.position.y, minCameraPos.y, maxCameraPos.y),
Mathf.Clamp(transform.position.z, minCameraPos.z, maxCameraPos.z));
}
}
So what is that actual error you get? Null reference exception and where is player defined?
Also, as you are just moving a transform and now a rigidbody, why not just use update?