From 76caa3ac2b4ee2ecabc53b28b84e5dfd1a9f19a8 Mon Sep 17 00:00:00 2001 From: Billie Cleek Date: Fri, 22 May 2020 16:46:54 -0700 Subject: [PATCH] highlight: handle exceptions when trying to add properties Fixes #2890 --- autoload/go/util.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/autoload/go/util.vim b/autoload/go/util.vim index 20242f39b9..8e54110a18 100644 --- a/autoload/go/util.vim +++ b/autoload/go/util.vim @@ -648,7 +648,14 @@ function! go#util#HighlightPositions(group, pos) abort let l:end_col = l:max - line2byte(l:end_lnum) + l:end_lnum - l:pos[0] let l:prop = {'type': a:group, 'end_lnum': l:end_lnum, 'end_col': l:end_col} endif - call prop_add(l:pos[0], l:pos[1], l:prop) + try + call prop_add(l:pos[0], l:pos[1], l:prop) + catch + " Swallow any exceptions encountered while trying to add the property + " Due to the asynchronous nature, it's possible that the buffer has + " changed since the buffer was analyzed and that the specified + " position is no longer valid. + endtry endfor return endif