Fix PR 19630, don't crash when file ends with whitespace.