[erlang] handle empty list in heap sort