LineRenderer.Setosition Index Out Of Bounds

I was doing Unity let’s try shooting with raycast tutorial, i have finished my script just like, but when i press fire button the console shows error LineRenderer.SetPosition Index Out Of Bounds, please help me.
My Script

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

public class Shooting : MonoBehaviour {
    public int Damage=1;
    public float FireRate = 0.25f;
    public float WeaponRange=50f;
    public float HitForce=100f;
    public Transform GunEnd;

    private Camera FpsCam;
    private WaitForSeconds ShotDuration= new WaitForSeconds(0.07f);
    private LineRenderer LaserLine;
    private float NextFire;
    private int Index = 0;
    void Start () 
    {
        LaserLine = GetComponent<LineRenderer>();
        FpsCam = GetComponentInParent<Camera>();
    }


    void Update ()
    {
        if (Input.GetKey(KeyCode.Mouse0) && Time.time > NextFire)
        {
            RaycastHit Hit;
            NextFire = Time.time + FireRate;
            StartCoroutine(ShotEffect());
            Vector3 RayStartPoint = FpsCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0));
           LaserLine.SetPosition(0, GunEnd.position);
            if(Physics.Raycast(RayStartPoint,FpsCam.transform.forward,out Hit,WeaponRange))
            {
                LaserLine.SetPosition(1,Hit.point);
            }
            else
            {
                LaserLine.SetPosition(1, RayStartPoint + (FpsCam.transform.forward * WeaponRange));
            }
        }
    }
    private IEnumerator ShotEffect()
    {
        LaserLine.enabled = true;
        yield return ShotDuration;
        LaserLine.enabled = false;
    }
}

LaserLine.numPosition = 2;
use this one before initialize your positions.

—>

LaserLine.numPosition = 2;

        LaserLine.SetPosition(0, GunEnd.position);
         if(Physics.Raycast(RayStartPoint,FpsCam.transform.forward,out Hit,WeaponRange))
         {
             LaserLine.SetPosition(1,Hit.point);
         }
         else
         {
             LaserLine.SetPosition(1, RayStartPoint + (FpsCam.transform.forward * WeaponRange));
         }