- "Index out of bounds" error prevention in Gauntlet mode.

This commit is contained in:
Agetian
2017-06-07 06:24:30 +00:00
parent b2461c73b0
commit bea2acbf29
2 changed files with 22 additions and 20 deletions

View File

@@ -58,6 +58,7 @@ public class GauntletWinLose extends ControlWinLose {
pnlResults.setLayout(new MigLayout("insets 0, gap 0, wrap " pnlResults.setLayout(new MigLayout("insets 0, gap 0, wrap "
+ (int) Math.ceil(len / 2d) + ", flowy")); + (int) Math.ceil(len / 2d) + ", flowy"));
if (!lstEventNames.isEmpty()) {
JLabel lblTemp; JLabel lblTemp;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
lblTemp = new FLabel.Builder().fontSize(14).build(); lblTemp = new FLabel.Builder().fontSize(14).build();
@@ -66,14 +67,14 @@ public class GauntletWinLose extends ControlWinLose {
lblTemp.setForeground(Color.green.darker()); lblTemp.setForeground(Color.green.darker());
lblTemp.setText((i + 1) + ". " + lstEventNames.get(i) lblTemp.setText((i + 1) + ". " + lstEventNames.get(i)
+ " (" + lstEventRecords.get(i) + ")"); + " (" + lstEventRecords.get(i) + ")");
} } else {
else {
lblTemp.setForeground(Color.red); lblTemp.setForeground(Color.red);
lblTemp.setText((i + 1) + ". ??????"); lblTemp.setText((i + 1) + ". ??????");
} }
pnlResults.add(lblTemp, "w 50%!, h 25px!, gap 0 0 5px 0"); pnlResults.add(lblTemp, "w 50%!, h 25px!, gap 0 0 5px 0");
} }
}
final SkinnedPanel pnl = view0.getPnlCustom(); final SkinnedPanel pnl = view0.getPnlCustom();
pnl.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center")); pnl.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center"));

View File

@@ -49,15 +49,16 @@ public class GauntletWinLose extends ControlWinLose {
@Override @Override
public void run() { public void run() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (!lstEventNames.isEmpty()) {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
if (i <= num) { if (i <= num) {
sb.append((i + 1) + ". " + lstEventNames.get(i) sb.append((i + 1) + ". " + lstEventNames.get(i)
+ " (" + lstEventRecords.get(i) + ")\n"); + " (" + lstEventRecords.get(i) + ")\n");
} } else {
else {
sb.append((i + 1) + ". ??????\n"); sb.append((i + 1) + ". ??????\n");
} }
} }
}
if (message1 != null) { if (message1 != null) {
sb.append("\n"); sb.append("\n");