Skip to content

Commit

Permalink
Merge pull request redis#438 from rayzyar/cmdInfoNil
Browse files Browse the repository at this point in the history
fix cmdInfo nil pointer panic
  • Loading branch information
vmihailenco authored Dec 9, 2016
2 parents 30be278 + fb584d2 commit 4ce47a0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cluster.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package redis

import (
"fmt"
"math/rand"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -371,7 +372,9 @@ func (c *ClusterClient) cmdSlotAndNode(state *clusterState, cmd Cmder) (int, *cl
return -1, node, err
}
slot := hashtag.Slot(firstKey)

if cmdInfo == nil {
return -1, nil, internal.RedisError(fmt.Sprintf("cmdInfo of %s is nil", cmd.arg(0)))
}
if cmdInfo.ReadOnly && c.opt.ReadOnly {
if c.opt.RouteByLatency {
node, err := state.slotClosestNode(slot)
Expand Down

0 comments on commit 4ce47a0

Please sign in to comment.