From 429245c3f9acbb7769551bea54800f5ae0342be9 Mon Sep 17 00:00:00 2001 From: Alex Bligh Date: Wed, 17 Feb 2016 14:03:32 +0000 Subject: [PATCH] Fix null datagram address With unix datagrams, apparently the address can be null. Use an empty string as the address in this case. Fixes #26 Signed-off-by: Alex Bligh --- server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server.go b/server.go index 93089f1..90bfd26 100644 --- a/server.go +++ b/server.go @@ -323,7 +323,11 @@ func (s *Server) goReceiveDatagrams(connection net.Conn) { for ; (n > 0) && (buf[n-1] < 32); n-- { } if n > 0 { - s.datagramChannel <- DatagramMessage{buf[:n], addr.String()} + var address string + if addr != nil { + address = addr.String() + } + s.datagramChannel <- DatagramMessage{buf[:n], address} } } else { // there has been an error. Either the server has been killed