redis-cli: Assert > 0 before dividing, to silence warning by tool (#9396)

Also make sure function can't return NULL by another assert.
This commit is contained in:
Viktor Söderqvist
2021-08-22 13:57:18 +03:00
committed by GitHub
parent 0835f596b8
commit 74590f8345
+2 -1
View File
@@ -4679,6 +4679,7 @@ static clusterManagerNode *clusterManagerNodeMasterRandom() {
master_count++;
}
assert(master_count > 0);
srand(time(NULL));
idx = rand() % master_count;
listRewind(cluster_manager.nodes, &li);
@@ -4690,7 +4691,7 @@ static clusterManagerNode *clusterManagerNodeMasterRandom() {
}
}
/* Can not be reached */
return NULL;
assert(0);
}
static int clusterManagerFixSlotsCoverage(char *all_slots) {