From 8ebec68caf9e23a445ef11932dbabcba32daf1a0 Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Sat, 29 Jun 2024 12:04:21 -0500 Subject: [PATCH] Doy! --- src/MissPiggy.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/MissPiggy.java b/src/MissPiggy.java index 2ea8b0e..0ab69a0 100644 --- a/src/MissPiggy.java +++ b/src/MissPiggy.java @@ -383,6 +383,9 @@ public class MissPiggy implements ActionListener { modList.addListSelectionListener(e -> { if (modList.getSelectedIndex() >= 0 && modList.getModel().getSize() >= 1) { // avoid race OOB when reinitializing mod list String authorDisplay; + + try { //debug + File pathReference = new File(System.getProperty("user.home") + "/.firestar/mods/" + Main.Mods.get(modList.getSelectedIndex()).path); DecimalFormat df = new DecimalFormat("##.##"); df.setRoundingMode(RoundingMode.UP); @@ -413,6 +416,17 @@ public class MissPiggy implements ActionListener { modFileSizeStr + " " + modFileSizeUnits + " in size" + "\n\n" + Main.Mods.get(modList.getSelectedIndex()).description );} + + catch (IndexOutOfBoundsException ex) { + System.out.println(ex.getMessage()); + System.out.println("mods " + Main.Mods.size()); + System.out.println("mod display " + modList.getModel().getSize()); + System.out.println("selection index " + modList.getSelectedIndex()); + + //System.exit(1); //user safety + } + + } }); } @@ -434,10 +448,9 @@ public class MissPiggy implements ActionListener { } bw.close(); - Main.Mods.clear(); //cleanup - priorityList = ""; - if(reload) { + Main.Mods.clear(); //cleanup + priorityList = ""; InitializeModListStructure(); InitializeModListInGUI(); }