varification error in editor script

hi, i am making a simple editor script that will take a heightmap and turn it in to a cubic terrain, but when trying to use the editor window i get this error:
VerificationException: Error verifying CubeLand:OnGUI (): Compare instruction applyed to ill formed stack (Complex x Int32) at 0x0040
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

this is the script:
#pragma strict
class CubeLand extends EditorWindow{

	var texture:Texture2D;
	var obj:GameObject;
	var sizeX:int = 100;
	var sizeZ:int = 100;
	var maxHeight:int;
	
	@MenuItem ("Window/CubeLand")
	
	static function ShowWindow(){
		EditorWindow.GetWindow (CubeLand);
	}
	
	function OnGUI () {
		texture = EditorGUI.ObjectField(Rect(3, 3, Screen.width, 100), "HeightMap", texture, Texture2D, true) as Texture2D;
		if(texture == !null){
			sizeX = EditorGUI.IntSlider(Rect(3, 106, Screen.width, 15), "X Size", sizeX, 100, texture.width);
			sizeZ = EditorGUI.IntSlider(Rect(3, 124, Screen.width, 15), "Z Size", sizeZ, 100, texture.height);
		}
		
		if(GUI.Button(Rect(0, Screen.height - Screen.height/10, Screen.width, Screen.height/10), "Generate")){
			if(texture == null){
				EditorUtility.DisplayDialog("You forgot somthing!", "You forgot to enter a texture, to proceed you must enter a texture that has a heighter reseolution of 100x100", "OK, I'll add a texture", "Cancel");
			}else if(texture.width <= 100 || texture.height <= 100){
				EditorUtility.DisplayDialog("You forgot somthing!", "You enterd a texture under the minumom resolution (100x100, please emter a new texture)", "OK, Ill, enter a differant texture", "Cancel");
			}
		}
	}
}

Is this what you are looking for?

#pragma strict 
class CubeLand extends EditorWindow {

    var texture:Texture2D;
    var cube : GameObject;
    var sizeX:int = 100;
    var sizeZ:int = 100;
    var maxHeight:int;
    var error : String;
     
    @MenuItem ("Window/CubeLand")
	static function ShowWindow() {
		EditorWindow.GetWindow(typeof(CubeLand));
	}
     
     function OnGUI () {
     	GUILayout.Space(20);
     	cube = EditorGUILayout.ObjectField("Cube", cube, GameObject, true) as GameObject;
         texture = EditorGUILayout.ObjectField("HeightMap", texture, Texture2D, true) as Texture2D;
         if(texture != null){
         	GUILayout.Label("X: " + sizeX.ToString());
             sizeX = GUILayout.HorizontalSlider(sizeX, 100, texture.width);
             GUILayout.Label("Z: " + sizeZ.ToString());
             sizeZ = GUILayout.HorizontalSlider(sizeZ, 100, texture.height);
         }
         
         if(GUILayout.Button("Generate")) {
         	if(texture == null){
				error = "You forgot to enter a texture.";
			} else if(texture.width <= 100 || texture.height <= 100){
				error = "The texture has to be atleast 100x100 pixels.";
			}
			if (String.IsNullOrEmpty(error)) {
				for (var x = 0; x < sizeX; x++) {
					for (var z = 0; z < sizeZ; z++) {
						var X = Mathf.Floor(texture.width / sizeX);
						var Z = Mathf.Floor(texture.height / sizeZ);
						var height = texture.GetPixel(X,Z).a * maxHeight;
						height = Mathf.Floor(height);
						GameObject.Instantiate(cube, Vector3(x,height,z), Quaternion.identity);
					}
				}
			}
         }
         GUILayout.Label(error);
     }
}