Merge "Fix displaying of file diff if draft patch has been deleted" into stable-2.5
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchSetSelectBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchSetSelectBox.java
index 5d4207f..afaf7fd 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchSetSelectBox.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchSetSelectBox.java
@@ -35,8 +35,8 @@
 import com.google.gwt.user.client.ui.Image;
 import com.google.gwtorm.client.KeyUtil;
 
-import java.util.LinkedList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 
 public class PatchSetSelectBox extends Composite {
   interface Binder extends UiBinder<HTMLPanel, PatchSetSelectBox> {
@@ -63,7 +63,7 @@
   PatchSet.Id idActive;
   Side side;
   PatchScreen.Type screenType;
-  List<Anchor> links;
+  Map<Integer, Anchor> links;
 
   @UiField
   HTMLPanel linkPanel;
@@ -88,7 +88,7 @@
     this.idSideA = idSideA;
     this.idSideB = idSideB;
     this.idActive = (side == Side.A) ? idSideA : idSideB;
-    this.links = new LinkedList<Anchor>();
+    this.links = new HashMap<Integer, Anchor>();
 
     linkPanel.clear();
 
@@ -105,7 +105,7 @@
       baseLink = createLink(PatchUtil.C.patchBase(), null);
     }
 
-    links.add(baseLink);
+    links.put(0, baseLink);
     if (screenType == PatchScreen.Type.UNIFIED || side == Side.A) {
       linkPanel.add(baseLink);
     }
@@ -117,7 +117,7 @@
     for (Patch patch : script.getHistory()) {
       PatchSet.Id psId = patch.getKey().getParentKey();
       Anchor anchor = createLink(Integer.toString(psId.get()), psId);
-      links.add(anchor);
+      links.put(psId.get(), anchor);
       linkPanel.add(anchor);
     }