à quelque chose malheur est bon

Etymology
lit. '[a] misfortune is good for something'.

Proverb

 * 1) every cloud has a silver lining; it's an ill wind that blows no one any good even a bad situation conceals some benefit