Prevent warnings picking slave from empty pool.

This commit is contained in:
Daniele Alessandri
2016-05-15 16:54:57 +02:00
parent 7be83a1fd6
commit 44ebf5a5e4
@@ -207,7 +207,9 @@ class MasterSlaveReplication implements ReplicationInterface
*/
protected function pickSlave()
{
return $this->slaves[array_rand($this->slaves)];
if ($this->slaves) {
return $this->slaves[array_rand($this->slaves)];
}
}
/**