Fix traceback when v:completed_item is empty

Check if the Vim variable v:completed_item is not empty before
accessing one of its keys. Prevent a traceback when the ycmd server
crashed.
This commit is contained in:
micbou 2015-12-27 18:46:05 +01:00
parent 7b6199e06b
commit f015d518a3

View File

@ -390,6 +390,9 @@ class YouCompleteMe( object ):
def _HasCompletionsThatCouldBeCompletedWithMoreText_NewerVim( self, def _HasCompletionsThatCouldBeCompletedWithMoreText_NewerVim( self,
completions ): completions ):
completed_item = vimsupport.GetVariableValue( 'v:completed_item' ) completed_item = vimsupport.GetVariableValue( 'v:completed_item' )
if not completed_item:
return False
completed_word = completed_item[ 'word' ] completed_word = completed_item[ 'word' ]
if not completed_word: if not completed_word:
return False return False