diff --git a/src/NATS.Client/Conn.cs b/src/NATS.Client/Conn.cs index 1ee8f8c80..a97481b36 100644 --- a/src/NATS.Client/Conn.cs +++ b/src/NATS.Client/Conn.cs @@ -2496,7 +2496,7 @@ internal void publish(string subject, string reply, byte[] data, int offset, int else kickFlusher(); - if (bw.Position + count + pubProtoLen > rbsize) + if (pending != null && bw.Position + count + pubProtoLen > rbsize) throw new NATSReconnectBufferException("Reconnect buffer exceeded."); } }