Fix some crashes

I wrote a fuzzer for Vim commands and found these exceptions getting thrown.

BTW, I found a couple of other crashes which happen when the file is either totally empty (zero bytes) or the last line doesn't end in a newline. How should IdeaVim handle these kinds of situations?