Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NullPointerException in cquery --output=graph. #13002

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.devtools.build.lib.skyframe.SkyframeExecutor;
import java.io.OutputStream;
import java.util.Comparator;
import java.util.Objects;

/** cquery output formatter that prints the result as factored graph in AT&T GraphViz format. */
class GraphOutputFormatterCallback extends CqueryThreadsafeCallback {
Expand All @@ -50,9 +51,18 @@ Iterable<KeyedConfiguredTarget> getDirectDeps(KeyedConfiguredTarget target)
// Order graph output first by target label, then by configuration hash.
Label label1 = ct1.getLabel();
Label label2 = ct2.getLabel();
return label1.equals(label2)
? ct1.getConfigurationChecksum().compareTo(ct2.getConfigurationChecksum())
: label1.compareTo(label2);
if (!label1.equals(label2)) {
return label1.compareTo(label2);
}
String checksum1 = ct1.getConfigurationChecksum();
String checksum2 = ct2.getConfigurationChecksum();
if (checksum1 == null) {
return -1;
} else if (checksum2 == null) {
return 1;
} else {
return checksum1.compareTo(checksum2);
}
};

@Override
Expand Down