Fix traceback print on None for |location|

This happens when the user invokes a GoTo* command on a file with no compilation
flags.
This commit is contained in:
Strahinja Val Markovic 2013-04-08 11:14:06 -07:00
parent 1268a258d7
commit 085df7e8af

View File

@ -169,7 +169,7 @@ class ClangCompleter( Completer ):
def _GoToDefinition( self ): def _GoToDefinition( self ):
location = self._LocationForGoTo( 'GetDefinitionLocation' ) location = self._LocationForGoTo( 'GetDefinitionLocation' )
if not location.IsValid(): if not location or not location.IsValid():
vimsupport.PostVimMessage( 'Can\'t jump to definition.' ) vimsupport.PostVimMessage( 'Can\'t jump to definition.' )
return return
@ -180,7 +180,7 @@ class ClangCompleter( Completer ):
def _GoToDeclaration( self ): def _GoToDeclaration( self ):
location = self._LocationForGoTo( 'GetDeclarationLocation' ) location = self._LocationForGoTo( 'GetDeclarationLocation' )
if not location.IsValid(): if not location or not location.IsValid():
vimsupport.PostVimMessage( 'Can\'t jump to declaration.' ) vimsupport.PostVimMessage( 'Can\'t jump to declaration.' )
return return
@ -191,9 +191,9 @@ class ClangCompleter( Completer ):
def _GoToDefinitionElseDeclaration( self ): def _GoToDefinitionElseDeclaration( self ):
location = self._LocationForGoTo( 'GetDefinitionLocation' ) location = self._LocationForGoTo( 'GetDefinitionLocation' )
if not location.IsValid(): if not location or not location.IsValid():
location = self._LocationForGoTo( 'GetDeclarationLocation' ) location = self._LocationForGoTo( 'GetDeclarationLocation' )
if not location.IsValid(): if not location or not location.IsValid():
vimsupport.PostVimMessage( 'Can\'t jump to definition or declaration.' ) vimsupport.PostVimMessage( 'Can\'t jump to definition or declaration.' )
return return