3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 11:59:40 +01:00

avoid nil reference in who reply

This commit is contained in:
Jeremy Latt 2014-02-11 09:09:16 -08:00
parent a34443f155
commit 0e07b29010

View File

@ -228,8 +228,12 @@ func RplChannelModeIs(channel *Channel) Reply {
// <channel> <user> <host> <server> <nick> ( "H" / "G" ) ["*"] [ ( "@" / "+" ) ]
// :<hopcount> <real name>
func RplWhoReply(server *Server, channel *Channel, client *Client) Reply {
channelName := "*"
if channel != nil {
channelName = channel.name
}
return NewNumericReply(server, RPL_WHOREPLY, "%s %s %s %s %s H :0 %s",
channel.name, client.username, client.hostname, server.name, client.nick,
channelName, client.username, client.hostname, server.name, client.nick,
client.realname)
}