Make 'strcmp' sort null equal with the empty string.
Factor out sort comparator, use it to replace conditional.