Permalink
Browse files

Fix traceback print on None for |location|

This happens when the user invokes a GoTo* command on a file with no compilation
flags.
  • Loading branch information...
1 parent 1268a25 commit 085df7e8af9dc341fef52fab4b3000edea968d41 @Valloric committed Apr 8, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 python/completers/cpp/clang_completer.py
@@ -169,7 +169,7 @@ def _LocationForGoTo( self, goto_function ):
def _GoToDefinition( self ):
location = self._LocationForGoTo( 'GetDefinitionLocation' )
- if not location.IsValid():
+ if not location or not location.IsValid():
vimsupport.PostVimMessage( 'Can\'t jump to definition.' )
return
@@ -180,7 +180,7 @@ def _GoToDefinition( self ):
def _GoToDeclaration( self ):
location = self._LocationForGoTo( 'GetDeclarationLocation' )
- if not location.IsValid():
+ if not location or not location.IsValid():
vimsupport.PostVimMessage( 'Can\'t jump to declaration.' )
return
@@ -191,9 +191,9 @@ def _GoToDeclaration( self ):
def _GoToDefinitionElseDeclaration( self ):
location = self._LocationForGoTo( 'GetDefinitionLocation' )
- if not location.IsValid():
+ if not location or not location.IsValid():
location = self._LocationForGoTo( 'GetDeclarationLocation' )
- if not location.IsValid():
+ if not location or not location.IsValid():
vimsupport.PostVimMessage( 'Can\'t jump to definition or declaration.' )
return

0 comments on commit 085df7e

Please sign in to comment.