Fix a crash that occurs with corrupt .gif files