Skip to content

Commit 0320db0

Browse files
committed
add missing null state attribute
1 parent 7644354 commit 0320db0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Smdn.Net.SkStackIP/Smdn.Net.SkStackIP/SkStackClient.Functions.PANA.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,17 @@ public void ThrowIfPanaSessionAlreadyEstablished()
158158
/// <exception cref="SkStackPanaSessionStateException">
159159
/// Cannot determine the current status of the PANA session.
160160
/// </exception>
161+
#if SYSTEM_DIAGNOSTICS_CODEANALYSIS_MEMBERNOTNULLATTRIBUTE
162+
[MemberNotNull(nameof(PanaSessionPeerAddress))]
163+
#endif
161164
public void ThrowIfPanaSessionNotAlive()
162165
{
163166
_ = PanaSessionState switch {
164167
// established
165-
SkStackEventNumber.PanaSessionEstablishmentCompleted => default(int), // throws nothing
168+
SkStackEventNumber.PanaSessionEstablishmentCompleted
169+
=> PanaSessionPeerAddress
170+
// inconsistency in internal state
171+
?? throw new InvalidOperationException($"{nameof(PanaSessionPeerAddress)} is set."),
166172

167173
// not established yet
168174
SkStackEventNumber.Undefined

0 commit comments

Comments
 (0)