From 5343590082538c7a3ee7acd9e2f927ae5bd704ba Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 24 Apr 2017 16:36:21 -0400 Subject: [PATCH] Fixed EncodeAddrspec and DecodeAddrspec to handle string.Empty Fixes issue #302 --- MimeKit/MailboxAddress.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MimeKit/MailboxAddress.cs b/MimeKit/MailboxAddress.cs index 84afceb3f6..830bb0ed0a 100644 --- a/MimeKit/MailboxAddress.cs +++ b/MimeKit/MailboxAddress.cs @@ -338,6 +338,9 @@ public static string EncodeAddrspec (string addrspec) throw new ArgumentNullException (nameof (addrspec)); #if !PORTABLE + if (addrspec.Length == 0) + return addrspec; + var buffer = CharsetUtils.UTF8.GetBytes (addrspec); int at, index = 0; string address; @@ -384,6 +387,9 @@ public static string DecodeAddrspec (string addrspec) throw new ArgumentNullException (nameof (addrspec)); #if !PORTABLE + if (addrspec.Length == 0) + return addrspec; + var buffer = CharsetUtils.UTF8.GetBytes (addrspec); int at, index = 0; string address;