diff --git a/src/NetMQ/Core/IOThread.cs b/src/NetMQ/Core/IOThread.cs index 261f995a..9f3e04f9 100644 --- a/src/NetMQ/Core/IOThread.cs +++ b/src/NetMQ/Core/IOThread.cs @@ -91,7 +91,8 @@ public void Ready() // Process all available commands. while (m_mailbox.TryRecv(out Command command)) { - command.Destination?.ProcessCommand(command); + Assumes.NotNull(command.Destination); + command.Destination.ProcessCommand(command); } } diff --git a/src/NetMQ/Core/Reaper.cs b/src/NetMQ/Core/Reaper.cs index 8eb1b562..d7853cb9 100644 --- a/src/NetMQ/Core/Reaper.cs +++ b/src/NetMQ/Core/Reaper.cs @@ -126,8 +126,10 @@ public void InEvent() if (!m_mailbox.TryRecv(0, out Command command)) break; + Assumes.NotNull(command.Destination); + // Process the command. - command.Destination?.ProcessCommand(command); + command.Destination.ProcessCommand(command); } } diff --git a/src/NetMQ/Core/SocketBase.cs b/src/NetMQ/Core/SocketBase.cs index fc20b24e..cf706321 100644 --- a/src/NetMQ/Core/SocketBase.cs +++ b/src/NetMQ/Core/SocketBase.cs @@ -1261,7 +1261,8 @@ private void ProcessCommands(int timeout, bool throttle, CancellationToken cance // Process all the commands available at the moment. while (found) { - command.Destination?.ProcessCommand(command); + Assumes.NotNull(command.Destination); + command.Destination.ProcessCommand(command); found = m_mailbox.TryRecv(0, out command); }