Skip to content

Commit e75d991

Browse files
committed
Merge pull request #27 from abligh/fix-null-datagram-address
Fix null datagram address
2 parents 31f917c + 429245c commit e75d991

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,11 @@ func (s *Server) goReceiveDatagrams(connection net.Conn) {
323323
for ; (n > 0) && (buf[n-1] < 32); n-- {
324324
}
325325
if n > 0 {
326-
s.datagramChannel <- DatagramMessage{buf[:n], addr.String()}
326+
var address string
327+
if addr != nil {
328+
address = addr.String()
329+
}
330+
s.datagramChannel <- DatagramMessage{buf[:n], address}
327331
}
328332
} else {
329333
// there has been an error. Either the server has been killed

0 commit comments

Comments
 (0)