Fixes NullPointerException in pkgcaches_test on ci.bazel.io Fixes #879. -- MOS_MIGRATED_REVID=114728312
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java index 4bf976a..6126197 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
@@ -85,9 +85,11 @@ // The outputBase may be null if we're not actually running a build. Path outputBase = pkgLocator.get().getOutputBase(); - Path relativeExternal = pkgLocator - .get().getOutputBase().getRelative(Label.EXTERNAL_PATH_PREFIX); - if (outputBase != null && !rootedPath.asPath().startsWith(relativeExternal)) { + if (outputBase == null) { + return; + } + Path relativeExternal = outputBase.getRelative(Label.EXTERNAL_PATH_PREFIX); + if (!rootedPath.asPath().startsWith(relativeExternal)) { return; }