sveawebpay / dotnet-integration

SDK for Sveas standalone payment methods
Other
5 stars 14 forks source link

Duplicate null-checks in HostedXmlBuilder.cs #13

Closed irkush closed 10 years ago

irkush commented 10 years ago

When adding a new element to the XmlWriter the value is checked for null.

Later inside the method that adds the valud to the Writer, the value is checked for null again.

Example:

if (individualIdentity.FirstName != null)
{
      WriteSimpleElement("firstname", individualIdentity.FirstName);
}

private void WriteSimpleElement(string name, string value)
{
     if (value == null)
     {
         return;
     }

     _xmlw.WriteStartElement(name);

     if (!value.Equals(""))
     {
          _xmlw.WriteChars(value.ToCharArray(), 0, value.ToCharArray().Length);
     }
    _xmlw.WriteEndElement();
}
Sinsabre commented 10 years ago

Solved in b09f10fbf80d8b0f4db01071e08ea83c72e3c4e0