Another Null Reference Exception

I am getting a null reference to the class partHull in the following code:
(this is not all of it, only the important parts)

public class partHull extends UnityEngine.MonoBehaviour
{
	public var position			:int;
	public var isPartUsed 		:boolean = false;
	private var jaska			:GameObject = Resources.Load("Alus");
	private var partLoc			:Vector3;

	public function partHull(num : int, vector : Vector3)
	{
		position = num;
		partLoc = vector;
	}
	public function guiLoop()
	{
		if (GUI.Button(Rect(10,170,50,30),"Plus")) {
			if (!isPartUsed) {
				partHullInstance = Instantiate(jaska, partLoc, transform.rotation);
				isPartUsed = true;
				partHullInstance.AddComponent("FixedJoint");
				partHullInstance.GetComponent("FixedJoint").connectedBody = rigidbody;
				partHullInstance.GetComponent("FixedJoint").breakForce = 5;
				partHullInstance.GetComponent("FixedJoint").breakTorque = 5;
			} else {
				Destroy(partHullInstance);
				isPartUsed = false;
}	}	}	}

paikka = new Vector3(-3,-3,0.75);
var hull = gameObject.GetComponent(partHull);
hull.partHull(1,paikka);

function OnGUI () {
hull.guiLoop();
}

The line giving me problems is hull.guiLoop();
It should be noted that hull is successfully referenced once in hull.partHull(1,paikka);

I have no idea what is wrong, and I am new to js so help is appreciated.

Lines 28-30 are not in any function. 28 and 29 should be moved to line7, and 30 should be in some function.