Fixed crash in Gallery on pause.