[less mode] Fix null dereference bug

Issue #1926