ReviewerRecommender: Prevent NPE when changeNotes is null

The changeNotes passed into suggestReviewers is possibly null, and
there is a check for this later in the method before attempting to
remove the change owner and existing reviewers from the list of
recommendations.

However the changeNotes was dereferenced to get the changeId to pass
into the plugin provided suggestReviewers method.

The suggestReviewers method annotates changeId as @Nullable, so we
can simply pass null there when changeNotes is null.

Change-Id: I4946b858dac05132cc65ebc6f4966a2fa0b23c11
This commit is contained in:
David Pursehouse 2018-02-07 21:27:03 +09:00
parent b747cae703
commit d19d0d307a
1 changed files with 1 additions and 1 deletions

View File

@ -134,7 +134,7 @@ public class ReviewerRecommender {
.get()
.suggestReviewers(
projectControl.getProject().getNameKey(),
changeNotes.getChangeId(),
changeNotes != null ? changeNotes.getChangeId() : null,
query,
reviewerScores.keySet()));
String key = plugin.getPluginName() + "-" + plugin.getExportName();