suggests that
even an unfortunate situation may have a useful consequence or offer an unexpected benefit.
similar
Every cloud has a silver lining.
Imagine a case where every difficult or sad situation has some comforting or more hopeful aspect.; then “Nothing so bad, as not to be good for something” fits well.