Skip to content

Commit 31b838a

Browse files
committed
Fixed ImapUtils EnvelopeAddress nullability
1 parent 3a0a4c9 commit 31b838a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

MailKit/Net/Imap/ImapUtils.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,12 +2087,12 @@ static async Task<bool> ShouldParseMultipartAsync (ImapEngine engine, Cancellati
20872087

20882088
readonly struct EnvelopeAddress
20892089
{
2090-
public readonly string Name;
2091-
public readonly string Route;
2092-
public readonly string Mailbox;
2093-
public readonly string Domain;
2090+
public readonly string? Name;
2091+
public readonly string? Route;
2092+
public readonly string? Mailbox;
2093+
public readonly string? Domain;
20942094

2095-
public EnvelopeAddress (string[] values)
2095+
public EnvelopeAddress (string?[] values)
20962096
{
20972097
Name = values[0];
20982098
Route = values[1];
@@ -2166,7 +2166,7 @@ public GroupAddress ToGroupAddress (ImapEngine engine)
21662166
}
21672167
}
21682168

2169-
static bool TryAddEnvelopeAddressToken (ImapToken token, ref int index, string[] values, bool[] qstrings, string format)
2169+
static bool TryAddEnvelopeAddressToken (ImapToken token, ref int index, string?[] values, bool[] qstrings, string format)
21702170
{
21712171
// This is a work-around for mail servers which output too many tokens for an ENVELOPE address. In at least 1 case, this happened
21722172
// because the server sent a literal token as the name component and miscalculated the literal length as 38 when it was actually 69
@@ -2177,9 +2177,9 @@ static bool TryAddEnvelopeAddressToken (ImapToken token, ref int index, string[]
21772177
// See https://github.com/jstedfast/MailKit/issues/1369 for details.
21782178
if (index >= 4) {
21792179
if (qstrings[0])
2180-
values[0] = MimeUtils.Quote (values[0]);
2180+
values[0] = MimeUtils.Quote (values[0]!);
21812181
if (qstrings[1])
2182-
values[1] = MimeUtils.Quote (values[1]);
2182+
values[1] = MimeUtils.Quote (values[1]!);
21832183
values[0] = values[0] + ' ' + values[1];
21842184
qstrings[0] = false;
21852185
qstrings[1] = qstrings[2];
@@ -2215,7 +2215,7 @@ static bool TryAddEnvelopeAddressToken (ImapToken token, ref int index, string[]
22152215

22162216
static EnvelopeAddress ParseEnvelopeAddress (ImapEngine engine, string format, CancellationToken cancellationToken)
22172217
{
2218-
var values = new string[4];
2218+
var values = new string?[4];
22192219
var qstrings = new bool[4];
22202220
ImapToken token;
22212221
int index = 0;
@@ -2239,7 +2239,7 @@ static EnvelopeAddress ParseEnvelopeAddress (ImapEngine engine, string format, C
22392239

22402240
static async Task<EnvelopeAddress> ParseEnvelopeAddressAsync (ImapEngine engine, string format, CancellationToken cancellationToken)
22412241
{
2242-
var values = new string[4];
2242+
var values = new string?[4];
22432243
var qstrings = new bool[4];
22442244
ImapToken token;
22452245
int index = 0;

0 commit comments

Comments
 (0)