Permalink
Browse files

Return an empty location instead of segfaulting

  • Loading branch information...
1 parent 1676a3b commit a00535f078e0cb89aa70a29b764862162622d6f3 @weslem weslem committed Apr 3, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 cpp/ycm/ClangCompleter/ClangCompleter.cpp
@@ -272,6 +272,9 @@ Location ClangCompleter::GetDeclarationLocation(
filename,
unsaved_files,
flags );
+ if (!unit) {
+ return Location();
+ }
return unit->GetDeclarationLocation( line, column, unsaved_files );
}
@@ -286,6 +289,9 @@ Location ClangCompleter::GetDefinitionLocation(
filename,
unsaved_files,
flags );
+ if (!unit) {
+ return Location();
+ }
return unit->GetDefinitionLocation( line, column, unsaved_files );
}

0 comments on commit a00535f

Please sign in to comment.