@@ -488,12 +488,13 @@ private static void PatchAddresses(this Core2EnterpriseUser user, PatchOperation
488488
489489 if
490490 (
491- string . IsNullOrWhiteSpace ( address . Country )
491+ address == null ||
492+ ( string . IsNullOrWhiteSpace ( address . Country )
492493 && string . IsNullOrWhiteSpace ( address . Locality )
493494 && string . IsNullOrWhiteSpace ( address . PostalCode )
494495 && string . IsNullOrWhiteSpace ( address . Region )
495496 && string . IsNullOrWhiteSpace ( address . StreetAddress )
496- && string . IsNullOrWhiteSpace ( address . Formatted )
497+ && string . IsNullOrWhiteSpace ( address . Formatted ) )
497498 )
498499 {
499500 if ( addressExisting != null )
@@ -951,19 +952,23 @@ private static void PatchPhoneNumbers(this Core2EnterpriseUser user, PatchOperat
951952 } ;
952953 }
953954
954- string value = operation . Value ? . Single ( ) . Value ;
955- if
956- (
957- value != null
958- && OperationName . Remove == operation . Name
959- && string . Equals ( value , phoneNumber . Value , StringComparison . OrdinalIgnoreCase )
960- )
955+ if ( phoneNumber != null )
961956 {
962- value = null ;
957+ string value = operation . Value ? . Single ( ) . Value ;
958+ if
959+ (
960+ value != null
961+ && OperationName . Remove == operation . Name
962+ && string . Equals ( value , phoneNumber . Value , StringComparison . OrdinalIgnoreCase )
963+ )
964+ {
965+ value = null ;
966+ }
967+
968+ phoneNumber . Value = value ;
963969 }
964- phoneNumber . Value = value ;
965970
966- if ( string . IsNullOrWhiteSpace ( phoneNumber . Value ) )
971+ if ( phoneNumber == null || string . IsNullOrWhiteSpace ( phoneNumber . Value ) )
967972 {
968973 if ( phoneNumberExisting != null )
969974 {
0 commit comments