Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,13 @@ private static void PatchAddresses(this Core2EnterpriseUser user, PatchOperation

if
(
string.IsNullOrWhiteSpace(address.Country)
address == null ||
(string.IsNullOrWhiteSpace(address.Country)
&& string.IsNullOrWhiteSpace(address.Locality)
&& string.IsNullOrWhiteSpace(address.PostalCode)
&& string.IsNullOrWhiteSpace(address.Region)
&& string.IsNullOrWhiteSpace(address.StreetAddress)
&& string.IsNullOrWhiteSpace(address.Formatted)
&& string.IsNullOrWhiteSpace(address.Formatted))
)
{
if (addressExisting != null)
Expand Down Expand Up @@ -951,19 +952,23 @@ private static void PatchPhoneNumbers(this Core2EnterpriseUser user, PatchOperat
};
}

string value = operation.Value?.Single().Value;
if
(
value != null
&& OperationName.Remove == operation.Name
&& string.Equals(value, phoneNumber.Value, StringComparison.OrdinalIgnoreCase)
)
if (phoneNumber != null)
{
value = null;
string value = operation.Value?.Single().Value;
if
(
value != null
&& OperationName.Remove == operation.Name
&& string.Equals(value, phoneNumber.Value, StringComparison.OrdinalIgnoreCase)
)
{
value = null;
}

phoneNumber.Value = value;
}
phoneNumber.Value = value;

if (string.IsNullOrWhiteSpace(phoneNumber.Value))
if (phoneNumber == null || string.IsNullOrWhiteSpace(phoneNumber.Value))
{
if (phoneNumberExisting != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public class TrustedJsonFactory : JsonFactory
public override Dictionary<string, object> Create(string json)
{
Dictionary<string, object> result =
(Dictionary<string, object>)JsonConvert.DeserializeObject(
json);
JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
return result;
}

Expand Down