Skip to content

Commit 9f4d101

Browse files
authored
Merge pull request #4139 from puremourning/changedtick-empty
Yet more attempts to catch 'changedtick' returning ''
2 parents d0657bb + 69e9803 commit 9f4d101

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

python/ycm/vimsupport.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ def GetCurrentBufferNumber():
182182

183183

184184
def GetBufferChangedTick( bufnr ):
185-
return GetIntValue( f'getbufvar({ bufnr }, "changedtick")' or 0 )
185+
try:
186+
return GetIntValue( f'getbufvar({ bufnr }, "changedtick")' )
187+
except ValueError:
188+
# For some reason, occasionally changedtick returns '' and causes an error.
189+
# In that case, just return 0 rather than spamming an error to the console.
190+
return 0
186191

187192

188193
# Returns a range covering the earliest and latest lines visible in the current
@@ -929,7 +934,7 @@ def GetBoolValue( variable ):
929934

930935

931936
def GetIntValue( variable ):
932-
return int( vim.eval( variable ) )
937+
return int( vim.eval( variable ) or 0 )
933938

934939

935940
def _SortChunksByFile( chunks ):

0 commit comments

Comments
 (0)