diff options
author | Bart Trojanowski <bart@jukie.net> | 2009-11-25 19:26:36 -0500 |
---|---|---|
committer | Bart Trojanowski <bart@jukie.net> | 2009-11-25 19:27:38 -0500 |
commit | e2fd1d9970d5ad61017a307ab133990150192d37 (patch) | |
tree | f61df0cbef4d36b9bf91184fd44c9a9484c1f5ea /vim/plugin | |
parent | 29b420700e45785dbfb5e0fac7b0fa0e1da689d8 (diff) |
vim: fix some error checking in NM_search_thread_id()
Diffstat (limited to 'vim/plugin')
-rw-r--r-- | vim/plugin/notmuch.vim | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index e1822a4..ade2e45 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -351,12 +351,15 @@ function! s:NM_search_thread_id() if !exists('b:nm_raw_lines') echoe 'no b:nm_raw_lines' return '' - else - let line = line('.') - let info = b:nm_raw_lines[line-1] - let what = split(info, '\s\+')[0] - return what endif + let mnum = line('.') - 1 + if len(b:nm_raw_lines) <= mnum + return '' + endif + echo 'len=' . string(len(b:nm_raw_lines)) . ' mnum=' . string(mnum) + let info = b:nm_raw_lines[mnum] + let what = split(info, '\s\+')[0] + return what endfunction function! s:NM_search_add_remove_tags(prompt, prefix, intags) |