Procházet zdrojové kódy

Properly handle an empty MRU file

Yegappan Lakshmanan před 3 roky
rodič
revize
8e8220a005
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  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 = []