Please help with this IndexOutOfRangeException error!!!

I get this error in my code, "
IndexOutOfRangeException: Index was outside the bounds of the array.
DialogueManager.Update () (at Assets/Scripts/DialogueManager.cs:41)“.
and i have no idea why, iv’e checked other forums on this but i cant figure it out. the error is on line 41 which is this"dText.text = dialogLines[currentLine];”.my script is this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DialogueManager : MonoBehaviour {

public GameObject dBox;
public Text dText;

public bool dialogueActive;

public string[ ] dialogLines;
public int currentLine;

// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
if (dialogueActive && Input.GetKeyDown(KeyCode.Q))
{
//dBox.SetActive(false);
//dialogueActive = false;

currentLine++;
}

if(currentLine >= dialogLines.Length)
{
dBox.SetActive(false);
dialogueActive = false;

currentLine = 0;
}

dText.text = dialogLines[currentLine];
}

public void ShowBox(string dialogue)
{
dialogueActive = true;
dBox.SetActive(true);
dText.text = dialogue;
}

public void ShowDialogue()
{
dialogueActive = true;
dBox.SetActive(true);
}
}

I’m not sure using arrays is what you need here. Maybe you should try lists and dictionaries: Lists and Dictionaries - Unity Learn

You could find useful info in this tutorial too, even if you don’t need the UI part of it: Recorded Video Training: Shop UI with Runtime Scroll Lists - Unity Learn

The beginner tutorial about arrays is here: Arrays - Unity Learn

I was following this tutorial and i copied everything, but it still gives me the error while he doesn’t get it:

Play it again then; you probably overlooked something.

i just rewatched the whole video but i still have the same error

Rewatching is not enough; you must make sure you did everything. For example, at 3:14 did you fill the dialog lines array in the DialogueManager? At 14:23, is the dialog lines array filled in the DialogHolder?