Fix nil dereference when network is specified in username
This commit is contained in:
parent
2dfbbf18fd
commit
461de13ecc
@ -335,9 +335,10 @@ func (dc *downstreamConn) register() error {
|
|||||||
return errAuthFailed
|
return errAuthFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var network *network
|
||||||
if networkName != "" {
|
if networkName != "" {
|
||||||
dc.network = dc.user.getNetwork(networkName)
|
network = u.getNetwork(networkName)
|
||||||
if dc.network == nil {
|
if network == nil {
|
||||||
dc.logger.Printf("failed registration: unknown network %q", networkName)
|
dc.logger.Printf("failed registration: unknown network %q", networkName)
|
||||||
dc.SendMessage(&irc.Message{
|
dc.SendMessage(&irc.Message{
|
||||||
Prefix: dc.srv.prefix(),
|
Prefix: dc.srv.prefix(),
|
||||||
@ -350,6 +351,7 @@ func (dc *downstreamConn) register() error {
|
|||||||
|
|
||||||
dc.registered = true
|
dc.registered = true
|
||||||
dc.user = u
|
dc.user = u
|
||||||
|
dc.network = network
|
||||||
|
|
||||||
u.lock.Lock()
|
u.lock.Lock()
|
||||||
firstDownstream := len(u.downstreamConns) == 0
|
firstDownstream := len(u.downstreamConns) == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user