Every cloud has a silver lining.



Meaning:
There is a positive side to every bad situation. In other words, bad things also produce some good.