Change.Id: Avoid NumberFormatException on empty user edit ref

Bug: Issue 4112
Change-Id: I7aa0ae0facf90bba0ad311f27768304b6c6ac1c3
This commit is contained in:
David Pursehouse
2016-05-16 16:08:19 +09:00
parent 7dbaf5706b
commit 7919be22eb

View File

@@ -160,7 +160,10 @@ public final class Change {
RefNames.EDIT_PREFIX.length();
int endChangeId = nextNonDigit(ref, startChangeId);
String id = ref.substring(startChangeId, endChangeId);
return new Change.Id(Integer.parseInt(id));
if (id != null && !id.isEmpty()) {
return new Change.Id(Integer.parseInt(id));
}
return null;
}
static int startIndex(String ref) {