Null reference adding material to list C#

The code digs through child nodes to pull out materials so I can animate the shield materials. The material is found as the error occurs inside an if statement requiring a material named shield. I’m confused as to why the line shields.Add(m); throws a null reference exception. Also I cant get code tags to work?


public class ShipCtrl : MonoBehaviour {

private List<Material> shields;//stores all shields for submeshes

void Start () {
    //find all shields and store in shields list
    Material[] materials;
    foreach (Transform childMesh in transform)
        materials = childMesh.renderer.materials;
        foreach (Material m in materials)
            if ( == "shield (Instance)")
                print("found Shield");

You declare the variable, but you don’t create the list. The first formatted line should be:

private List<Material> shields = new List<Material>();