Check if compression was successful before caching

Fix a crash on radeon.