diff --git a/querysync/java/com/google/idea/blaze/qsync/AffectedPackagesCalculator.java b/querysync/java/com/google/idea/blaze/qsync/AffectedPackagesCalculator.java index 9b69bcf660a..fceea387769 100644 --- a/querysync/java/com/google/idea/blaze/qsync/AffectedPackagesCalculator.java +++ b/querysync/java/com/google/idea/blaze/qsync/AffectedPackagesCalculator.java @@ -95,6 +95,11 @@ public AffectedPackages getAffectedPackages() { context().output(PrintOutput.log("Edited %d BUILD files", buildFileChanges.size())); for (WorkspaceFileChange c : buildFileChanges) { Path buildPackage = c.workspaceRelativePath.getParent(); + + if (buildPackage == null) { + buildPackage = Path.of(""); + } + if (c.operation != Operation.ADD) { // modifying/deleting an existing package if (!lastQuery().getPackages().contains(buildPackage)) {