Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Campaign file cannot be loaded (ArrayIndexOutOfBounds) #76

Closed
Question2 opened this issue May 15, 2016 · 3 comments
Closed

Campaign file cannot be loaded (ArrayIndexOutOfBounds) #76

Question2 opened this issue May 15, 2016 · 3 comments
Labels
Milestone

Comments

@Question2
Copy link

I have a feeling this is related to several refits that I had running at the time...

java.lang.ArrayIndexOutOfBoundsException: -1
at mekhq.campaign.unit.Unit.initializeParts(Unit.java:1771)
at mekhq.campaign.Campaign.createCampaignFromXMLFileInputStream(Campaign.java:3969)
at mekhq.gui.dialog.DataLoadingDialog$Task.doInBackground(DataLoadingDialog.java:184)
at mekhq.gui.dialog.DataLoadingDialog$Task.doInBackground(DataLoadingDialog.java:113)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

#battletech.zip

@Question2
Copy link
Author

Question2 commented May 16, 2016

Just had it happen on a new save, this time i didnt have any refits going.

I did some testing and figured out the cause. Refitting an Elemental [MG] point to the [MG 2] variant causes the save file to become unloadable after the refit is finished.

test save is the save before the refit is done, test2 is the save after the refit is done and the save cannot be loaded.

#battletech.zip

Edit : Looking at the test 2 campaign save, it seems that mekhq assigns 1 BA suit part per elemental point. Refitting the elemental point causes you to order 5 suit parts instead (1 per trooper) instead of 1 per point. Deleting all the new suit parts allows the save to be loaded. The original trooper suit part also had trooper set to 5 (for the size of the squad) while the extra suit parts from the refit all had trooper set to -1. Changing -1 to 5 allows the campaign save to be loaded as well.

@Dylan-M Dylan-M changed the title 3.27 : Campaign file cannot be loaded (ArrayIndexOutOfBounds) Campaign file cannot be loaded (ArrayIndexOutOfBounds) Oct 2, 2016
@Dylan-M Dylan-M added the Bug label Oct 2, 2016
@Dylan-M Dylan-M added this to the Post-Stable milestone Oct 2, 2016
@Dylan-M
Copy link
Contributor

Dylan-M commented Oct 2, 2016

Post-Stable because BA aren't fully implemented.

@neoancient
Copy link
Member

Resolved by d56a13d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants