I have this line of code in a method I'm writing:
Dictionary<string, object> fieldsVal = file.ListItemAllFields.FieldValues;
if (fieldsVal.ContainsKey(System.Xml.XmlConvert.EncodeName("State0")) && fieldsVal[System.Xml.XmlConvert.EncodeName("State0")].ToString() == "12 final approvement" && (extension ==
".csv" || extension == ".jpg" || extension == ".png" || extension == "xlsx"))
I get a System.NullReferenceException in the line where the if statement starts and I don't understand why.