Test if keys are empty before sorting