Object reference not set to an instance of an Object C#

Hello guys hehe im new to C# and making a Visual novel. I don’t know what to do with this error T^T
please help a newbie here

here’s my Script

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using UnityEngine;

public class DialogueParserScript : MonoBehaviour {

    List <DialogueLine> lines;


    struct DialogueLine {
        string name;
        string content;
        int pose;

        public DialogueLine(string n, string c, int p)
        {
            name = n;
            content = c;
            pose = p;
        }

    }



    // Use this for initialization
    void Start () {
        /*string file = "Dialouge";
        string sceneNum = EditorApplication.currentScene;
        sceneNum = Regex.Replace (sceneNum,"[^0]-9]", "");
        file += sceneNum;
        file += ".txt";*/
        string file = "Dialogue1.txt";

        LoadDialogue(file);
    }
   
    // Update is called once per frame
    void Update () {
       
    }

    void LoadDialogue(string filename){

        string file = "C:/Users/gabe/Documents/UnityGame/_INYTSMC/Assets/Resources/" + filename;
        string line;
        StreamReader r = new StreamReader(file);

        using (r){
            do
            {
                line = r.ReadLine();
                if(line != null)
                {
                   string[] line_values = line.Split('|');
                    DialogueLine line_entry = new DialogueLine( line_values[0],line_values[1], int.Parse(line_values[2]));
                    lines.Add(line_entry);

                    Debug.Log(line_values[0]);
                    Debug.Log(line_values[1]);
                    Debug.Log(line_values[2]);
                }

            }
            while (line != null);
            r.Close();


        }

    }
}

The exact error message is:

NullReferenceException: Object reference not set to an instance of an object
DialogueParserScript.LoadDialogue (System.String filename) (at Assets/Resources/Scripts/DialogueParserScript.cs:61)

Your list is not initialized.

in start add this line above LoadDialogue(file);

lines = new List();

You need to do this because while you have created a place to store a reference to a List, the line Brathnaan posted actually instantiates one and associates it with your reference.

For example, a script might receive or retrieve a list upon creation rather than starting a new one.

oh my gosh thank you so much :smile::smile::smile::smile::smile: