C# - Mathf.Lerp: NullReferenceException: Object reference not set

Full error:

NullReferenceException: Object reference not set to an instance of an object
MouseLook.FixedUpdate () (at Assets/MouseLook.cs:32)

I don’t know if I did something stupid, but the line of code that doesn’t work is:

transform.up = Vector3.Lerp (transform.up, transform.parent.up, 0.25f);

I am trying to set the main camera’s position to the position of the player capsule, but it just keeps throwing that error. Any ideas?

Maybe is problem with modifying tranform.up, i am not really sure if it is posible. You could modify transform.position.