Breaking point for a random fleet spawned in with a console command seems to be 5. Haven't had a crash with 4 (yet). The culprit is this block, starting at line 446:
if (remaining > 0) {
List<String> mods = new ArrayList<String>();
mods.add(HullMods.FLUX_DISTRIBUTOR);
mods.add(HullMods.FLUX_COIL);
if (current.getHullSize() == HullSize.FRIGATE || current.hasHullMod(HullMods.SAFETYOVERRIDES)) {
mods.add(HullMods.HARDENED_SUBSYSTEMS);
mods.add(HullMods.REINFORCEDHULL);
} else {
mods.add(HullMods.REINFORCEDHULL);
mods.add(HullMods.HARDENED_SUBSYSTEMS);
}
mods.add(HullMods.BLAST_DOORS);
while (!mods.isEmpty() && current.hasHullMod(mods.get(0))) {
mods.remove(0);
}
for (int i = 0; i < remaining; i++) {
current.setNumFluxCapacitors(0);
current.setNumFluxVents(0);
String modId = mods.get(Math.min(i, mods.size() - 1));
addHullmods(current, delegate, modId);
convertToSMods(current, 1);
// addExtraVents(current);
// addExtraCaps(current);
}
The for-loop doesn't check whether the list is empty or not and calls "get" with -1 for index.