mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- "Index out of bounds" error prevention in Gauntlet mode.
This commit is contained in:
@@ -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"));
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user