This project has moved and is read-only. For the latest updates, please go here.
1

Closed

Null Reference Exception when retrieving the default group with no members

description

Hello, I was using your code (great work by the way) wanted to let you know there was a bug when retrieving the default group with no members. It happens in the Prompt.Ymlp.YmlpConnector.ParseResult(XElement Input) method. Line 225 threw a null reference exception. I checked my default group and there aren't any members. I added a simple IF statement to check the element before creating the new contact. My modified source is below. Hope this helps. Cheers. - Luke
if (item.Element("Email") != null)
                  {
                    Contact newcontact = new Contact()
                    {
                      EmailAddress = item.Element("EMAIL").Value
                    };
                    int NumberOfFieldsFound = item.Elements().Count();
                    if (NumberOfFieldsFound > 0)
                    {
                      newcontact.Fields = new Dictionary<string, string>();
                      for (int i = 1; i < NumberOfFieldsFound; i++)
                      {
                        string key = "FIELD" + i.ToString();
                        newcontact.Fields.Add(key, item.Element(key).Value);
                      }
                    }
                    ResponseContactList.Add(newcontact);
                  }
Closed Jan 27, 2011 at 9:30 PM by dampee

comments

dampee wrote Jan 27, 2011 at 7:59 PM

Hi Luke,
Thanks a lot for the feedback. I'll see if i can update the code.

dampee wrote Jan 27, 2011 at 9:30 PM

update in changeset 56802

wrote Jan 27, 2011 at 9:30 PM

wrote Feb 12, 2013 at 10:38 PM

wrote May 14, 2013 at 10:19 PM