NPE when deleting draft patch set when previous draft already deleted

If a change has 3 patch sets, all of which are drafts, and draft
patch set 2 is deleted, attempting to delete draft patch set 3 (the
current patch set) will result in NPE.

The reason is that on deleting a draft patch set which is the current
patch set, the current patch set is set to the previous patch set
whose ID is calculated by subtracting 1 from the deleted patch set ID.

This does not work if the previous patch set has already been deleted.

Instead, set the current patch set to the highest patch set ID that
is available.

Bug: Issue 2128
Change-Id: I235d4d943a5525e8223218a97f4702e26f09a69e
1 file changed