From b7e996cd8c740a81350521866d7795da4cb3f3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Mon, 30 Jan 2017 17:27:43 +0100 Subject: [PATCH] Let TCPConnection.peek() handle closed connections gracefully. --- source/vibe/core/net.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/vibe/core/net.d b/source/vibe/core/net.d index cf53530..ba12fa7 100644 --- a/source/vibe/core/net.d +++ b/source/vibe/core/net.d @@ -518,7 +518,7 @@ mixin(tracer); return m_context.readBuffer.length > 0; } - const(ubyte)[] peek() { return m_context.readBuffer.peek(); } + const(ubyte)[] peek() { return m_context ? m_context.readBuffer.peek() : null; } void skip(ulong count) {