nie ma tego złego, co by na gorsze nie wyszło

Etymology
lit. 'there wouldn't be this bad [thing], which wouldn't work out for the better'.