Fix crash upon pressing End key with nothing loaded. (github-39)