Fix NullPointerException in delete-vote REST API

Fix the code which caused the NullPointerException.

The commit which broke this:
https://gerrit-review.googlesource.com/#/c/93482/

Change-Id: Iedda3900396cd33f7dc40acac47968f493d13e3c
This commit is contained in:
Changcheng Xiao
2017-01-12 11:39:06 +01:00
parent 6c5fa05cdd
commit 0c811c3e6e

View File

@@ -59,11 +59,11 @@ public class Votes implements ChildCollection<ReviewerResource, VoteResource> {
public VoteResource parse(ReviewerResource reviewer, IdString id)
throws ResourceNotFoundException, OrmException, AuthException,
MethodNotAllowedException {
if (!reviewer.getRevisionResource().isCurrent()) {
if (reviewer.getRevisionResource() != null
&& !reviewer.getRevisionResource().isCurrent()) {
throw new MethodNotAllowedException(
"Cannot access on non-current patch set");
}
return new VoteResource(reviewer, id.get());
}