Good catch! I've implemented your suggested fix of adding a sed '/^$/d' at the beginning of McIlroy's pipeline. The github code is updated, along with an updated test file and expected output.
(Btw, the Python version did not have the bug, since the split method of Python strings already ignores initial whitespace.)