C# Mesh generation error

Hello everyone, I am attempting to generate one face of a mesh and am having some trouble.
My error is :Failed setting triangles. Some indices are referencing out of bounds vertices.
UnityEngine.Mesh:set_triangles(Int32[ ])
MeshGenTest:Start() (at Assets/MeshGenTest.cs:29)

This is my code:

using UnityEngine;
using System.Collections;

public class MeshGenTest : MonoBehaviour {
Vector3[] newVertices = new Vector3[4];
//Vector2[] newUV = new Vector2[4];
int[] newTriangles = new int[3];
	
void Start () {

		
newVertices[0] = new Vector3(-10,0,0);
newVertices[1] = new Vector3(10,0,0);
newVertices[2] = new Vector3(-10,10,0);
newVertices[3] = new Vector3(10,10,0);

newTriangles[0] = 0;
newTriangles[1] = 1;
newTriangles[2] = 3;


Mesh mesh = new Mesh ();
MeshFilter mf = (MeshFilter)gameObject.GetComponent(typeof(MeshFilter));
mf.mesh.Clear();
mf.mesh = mesh;
//mesh.uv = newUV;
mf.mesh.vertices = newVertices;
mf.mesh.name = "MeshTest";
mesh.triangles = newTriangles;
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

Any help would be much appreciated. I cant seem to figure out why it is saying the indices are out of bounds when I look at it all the points I entered are vertices I have already created. I am new to c#, so It may just be some simple mistake.

Okay, I feel really dumb now. My error was on line 29, where instead of writing mf.mesh.triangles I just wrote mesh.triangles. Somehow I spent an two hours looking at it and only after posting to forum did I see the error.