cover (one's) bases
To ensure one's safety or success by dealing with every potentially problematic aspect of a situation or activity. A reference to baseball, in which the defensive players must make sure all bases (and baserunners who may occupy them) are accounted for. Primarily heard in US, South Africa. We have to be sure to cover our bases before the trial begins so that we aren't surprised by anything the prosecution throws our way.