avoir de la chance dans son malheur

Etymology
lit. 'to have luck in one's misfortune'.

Verb

 * 1) to have been lucky in one's misfortune