1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 19:40:27 +01:00

Handle invalid ctags line numbers, closes #119

This commit is contained in:
Jan Larres
2013-09-19 12:36:41 +12:00
parent 5566cb34d5
commit 3c37ddcc14

View File

@@ -2189,6 +2189,10 @@ function! s:ParseTagline(part1, part2, typeinfo, fileinfo) abort
if has_key(taginfo.fields, 'lineno')
let taginfo.fields.line = str2nr(taginfo.fields.lineno)
endif
" Do some sanity checking in case ctags reports invalid line numbers
if taginfo.fields.line < 0
let taginfo.fields.line = 0
endif
" Make some information easier accessible
if has_key(a:typeinfo, 'scope2kind')
@@ -2871,6 +2875,13 @@ function! s:HighlightTag(openfolds, ...) abort
" instead in that case
let tagline = tag.getClosedParentTline()
" Parent tag line number is invalid, better don't do anything
if tagline == 0
call s:winexec(prevwinnr . 'wincmd w')
redraw
return
endif
" Go to the line containing the tag
execute tagline