Set pos when data is empty

Fixes #323
This commit is contained in:
Kien N 2012-12-04 07:14:02 +07:00
parent 254144e14b
commit 5b98c7453f

View File

@ -1990,7 +1990,7 @@ endf
fu! s:insertcache(str)
let [data, g:ctrlp_newcache, str] = [g:ctrlp_allfiles, 1, a:str]
if strlen(str) <= strlen(data[0])
if data == [] || strlen(str) <= strlen(data[0])
let pos = 0
elsei strlen(str) >= strlen(data[-1])
let pos = len(data) - 1