From 420337dc4a01f38e000d9f1c3823efe26721b185 Mon Sep 17 00:00:00 2001
From: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Date: Fri, 9 Dec 2016 15:52:36 +0200
Subject: [PATCH] Simplify cmdInfo check.

---
 cluster.go | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/cluster.go b/cluster.go
index 673f3ff..ec5a51f 100644
--- a/cluster.go
+++ b/cluster.go
@@ -1,7 +1,6 @@
 package redis
 
 import (
-	"fmt"
 	"math/rand"
 	"sync"
 	"sync/atomic"
@@ -367,14 +366,12 @@ func (c *ClusterClient) state() *clusterState {
 func (c *ClusterClient) cmdSlotAndNode(state *clusterState, cmd Cmder) (int, *clusterNode, error) {
 	cmdInfo := c.cmds[cmd.arg(0)]
 	firstKey := cmd.arg(cmdFirstKeyPos(cmd, cmdInfo))
-	if firstKey == "" {
+	if firstKey == "" || cmdInfo == nil {
 		node, err := c.nodes.Random()
 		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)