instantiating particle effect at mouse location?

I have this code here but im getting an error at line 7 “Object reference not set to an instance of an object” I dont understand what reference are they talking about…

var blue : GameObject;
private var screenPos : Vector3;
private var viewPos : Vector3;

function Update () {

screenPos = Input.MousePosition;
viewPos = camera.ScreenToViewportPoint(screenPos);
if(Input.GetMouseButton(0))
	Instantiate(blue,viewPos,Quaternion.identity);

}

Ok i fixed it… apparently i had to connect the script to the camera, instead of an empty gameobject like i had… also this is my updated working code…

var blue : GameObject;
private var mousePos : Vector3;
private var worldPos : Vector3;

function Update () {
	
	if(Input.GetMouseButton(0)) {
		mousePos = Input.mousePosition;
		mousePos.z = 1.5;
		worldPos = camera.ScreenToWorldPoint(mousePos);
		Instantiate(blue,worldPos,Quaternion.identity);
	}
}