Resharper is showing a "Possible System.NullReferenceException" warning. I however can't see how I can get one.
public class PlaceController : PlanningControllerBase
{
[Authorize]
public ActionResult StartStop(int id)
{
if (Request != null && Request.Cookies != null && Request.Cookies["place"] != null)
{
if (Request.Cookies["place"].Value != null)//Possible NullReferenceException?
{
string placeInformation = Request.Cookies["place"].Value;//Possible NullReferenceException?
//...
}
}
}
}
How can this give a NullReference if I check all fields? Using the following doesn't show the warning:
Request.Cookies[0];//Index instead of name
Edit: updated code.