mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Fix client panic on absent server field
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
@@ -1949,12 +1950,12 @@ func (c *client) processRouteConnect(srv *Server, arg []byte, lang string) error
|
||||
c.closeConnection(WrongGateway)
|
||||
return ErrWrongGateway
|
||||
}
|
||||
var perms *RoutePermissions
|
||||
//TODO this check indicates srv may be nil. see srv usage below
|
||||
if srv != nil {
|
||||
perms = srv.getOpts().Cluster.Permissions
|
||||
|
||||
if srv == nil {
|
||||
return errors.New("server is not set")
|
||||
}
|
||||
|
||||
perms := srv.getOpts().Cluster.Permissions
|
||||
clusterName := srv.ClusterName()
|
||||
|
||||
// If we have a cluster name set, make sure it matches ours.
|
||||
|
||||
Reference in New Issue
Block a user