PostReview: Remove redundant null-check
The `current` variable is initialised with the return value from the scanLabels method, which always returns a Map instance, which may be empty, but does not return null. It is therefore not necessary to check for `current` being null in the initialisation of `allApprovals`. Removing the null-check prevents FindBugs from warning about potential null-pointer exceptions on subsequent dereferences of `current` that are not guarded by null-checks. Change-Id: If5f2d575a8c44e47e82ec656b494fceb1667a182
This commit is contained in:
@@ -567,10 +567,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
||||
Map<String, PatchSetApproval> current = scanLabels(ctx, del);
|
||||
|
||||
// get all approvals in cases of quick approve vote
|
||||
Map<String, Short> allApprovals = Collections.emptyMap();
|
||||
if (current != null) {
|
||||
allApprovals = approvalsByKey(current.values());
|
||||
}
|
||||
Map<String, Short> allApprovals = approvalsByKey(current.values());
|
||||
allApprovals.putAll(inLabels);
|
||||
|
||||
// get previous label votes
|
||||
|
||||
Reference in New Issue
Block a user