When I try remove item of a list I get "Object reference not set to an instance of an object". Here is the code:
protected void btnIzvadi_Click(object sender, EventArgs e)
{
    if (Session["kosnice"] == null)
    {
        lblError.Text = "Вашата купувачка кошничка е празна";
    }
    else
    {
        try
        {
            List<string> kosnicka = new List<string>();
            kosnicka = (List<string>)Session["kosnice"];
            for (int i = 0; i < lstKosnicka.Items.Count; i++)
            {
                kosnicka.Add(lstKosnicka.Items[i].Text);
            }
            string pom = lstKosnicka.SelectedItem.Text;
            kosnicka.Remove(pom);
            for (int i = 0; i < kosnicka.Count; i++)
            {
                lblError.Text = " " + kosnicka[i];
            }
            Session["kosnice"] = kosnicka;
            lstKosnicka.DataSource = kosnicka;
            lstKosnicka.DataBind();
        }
        catch (NullReferenceException err)
        {
            lblError.Text = err.Message;
        }
    }
}
The list form that I get the exception is not empty and it has reqired field validator concerned to btnIzvadi.
 
     
    