Object reference not set to an instance of an object

i keep getting this error called Object reference not set to an instance of an object and i dont know how to fix it

here is the script

var run = false;
    var timer : float = 0.0;


    if(Input.GetButton ("left shift"))
    {   
    speed = 30;
    run = true;
    }
if(run)
    {
    timer += Time.deltaTime;
    }
if(timer >= 5)
    {
    run = false;
    speed = 15;
    timer = 0;
}

Just because, try this.

    var run = false;
    var timer : float = 0.0;
    var speed : float = 0.0;

    if(Input.GetButton ("left shift"))
    {   
    speed = 30;
    run = true;
    }
if(run)
    {
    timer += Time.deltaTime;
    }
if(timer >= 5)
    {
    run = false;
    speed = 15;
    timer = 0;
}