Skip to content

Commit

Permalink
Call inferBazelSourceroot defensively
Browse files Browse the repository at this point in the history
  • Loading branch information
antonsviridov-src committed Aug 20, 2024
1 parent 94e8cb8 commit 69699b6
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void started(TaskEvent e) {
// we remove the semanticdb file for this source file to ensure
// stale data doesn't cause problems
if (e.getKind() == TaskEvent.Kind.ENTER) {
inferBazelSourceroot(e.getSourceFile());
Result<Path, String> semanticdbPath = semanticdbOutputPath(options, e);
if (semanticdbPath.isOk()) {
try {
Expand Down Expand Up @@ -283,8 +284,6 @@ private void inferBazelSourceroot(JavaFileObject file) {

private Result<Path, String> semanticdbOutputPath(SemanticdbJavacOptions options, TaskEvent e) {
Path absolutePath = absolutePathFromUri(options, e.getSourceFile());
if (absolutePath == null)
return Result.error("Failed to produce absolute path for " + e.getSourceFile());
if (absolutePath.startsWith(options.sourceroot)) {
Path relativePath = options.sourceroot.relativize(absolutePath);
String filename = relativePath.getFileName().toString() + ".semanticdb";
Expand Down

0 comments on commit 69699b6

Please sign in to comment.