Explorar o código

Properly handle an empty MRU file

Yegappan Lakshmanan %!s(int64=3) %!d(string=hai) anos
pai
achega
8e8220a005
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      plugin/mru.vim

+ 4 - 1
plugin/mru.vim

@@ -152,7 +152,10 @@ func! s:MRU_LoadList() abort
   " start with an empty list.
   if filereadable(s:MRU_File)
     let s:MRU_files = readfile(s:MRU_File)
-    if s:MRU_files[0] =~# '^\s*" Most recently edited files in Vim'
+    if empty(s:MRU_files)
+      " empty MRU file
+      let s:MRU_files = []
+    elseif s:MRU_files[0] =~# '^\s*" Most recently edited files in Vim'
       " Generated by the previous version of the MRU plugin.
       " Discard the list.
       let s:MRU_files = []