You need to sign in to do that
Don't have an account?
SteveSFDev
NullReferenceException errors
Hi
I'm having problems handling NullReferenceException errors. This occurs when a contact first or last name is blank or null.
I tried using the following code to deal with these scenarios but it does not seem to solve the problem
String FirstName = (contact.FirstName.ToString() != null) ? contact.FirstName.ToString() : "";
catch (NullReferenceException Nullex) {
LogError(Nullex.InnerException.ToString());
}
Either of this code line work
Superfell
String FirstName = contact.FirstName == null ? "" : contact.FirstName;
SteveSFDev
Thanks that works