Null Reference Exeption

Hi all! I’m working on a game where the Player must collect Christmas presents to win the game. In the script at line 15 however, it comes up in the console with this error:

NullReferenceException: Object reference not set to an instance of an object
Christmas Collect.Update () (at Assets/Scripts/My Scripts/Christmas Collect.js:15)

Here is the script. Can anyone help me fix this please?

var papers : int = 0;
var papersToWin : int = 5;
var distanceToPaper : float = 5;
//public var paperpickup : AudioClip;

function Start()
{
	Screen.lockCursor = true;
}

function Update()
{
	if(Input.GetKeyDown(KeyCode.P) || Input.GetMouseButtonUp(0))
	{
		var ray = Camera.main.ScreenPointToRay( Vector3(Screen.width * 0.5, Screen.height * 0.5, 0));
		var hit : RaycastHit;
		if(Physics.Raycast(ray, hit, distanceToPaper))
		{
			if(hit.collider.gameObject.name == "Paper")
			{
				papers += 1;
				//audio.PlayOneShot(paperpickup);
				Debug.Log("A paper was picked up. Total papers = " + papers);
				Destroy(hit.collider.gameObject);
			}
		}
	}
}

function OnGUI()
{
	if(papers < papersToWin)
	{
		GUI.Box(Rect((Screen.width/2)-100, 10, 200, 35), "" + papers + " Presents");
	}
	else
	{
		GUI.Box(Rect((Screen.width/2)-100, 10, 200, 35), "Merry Christmas!");
	}
}

If the error is on this line:

var ray = Camera.main.ScreenPointToRay( Vector3(Screen.width * 0.5, Screen.height * 0.5, 0));

…then you’ve likely change the tag on main camera. This line depends on the Camera being tagged ‘MainCamera’, which is the default for the main camera when creating a new scene.