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

3.25 : NPE when advancing a day #31

Closed
Question2 opened this issue Mar 21, 2016 · 12 comments
Closed

3.25 : NPE when advancing a day #31

Question2 opened this issue Mar 21, 2016 · 12 comments
Labels

Comments

@Question2
Copy link

Last thing i did was start repairing damaged equipment in the warheouse (a lot of them) before advancing a day, and i got a NPE.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

Save game is attached.
#battletech.zip

@Question2 Question2 changed the title NPE when advancing a day 3.25 : NPE when advancing a day Mar 21, 2016
@Akjosch
Copy link
Contributor

Akjosch commented Mar 21, 2016

You assigned Cpt. Travis Riviera (who has like no tech skills, at all) to work on repairing an AMS.

I'm not sure if that assignment should be made totally impossible (yes, it will always fail, but you could still gain XP from it I guess, while burning through equipment), but the code certainly needs a guard there, just in case.

@arlith
Copy link
Contributor

arlith commented Mar 21, 2016

I don't think the UI is supposed to allow people without the proper skill to be assigned to a repair job. There's potentially a bug in how this assignment was allowed. (I'm not super familiar with MHQ code, so I may be wrong).

@Dylan-M
Copy link
Contributor

Dylan-M commented Mar 21, 2016

@arlith No, you are correct. An assignment should not be allowed unless the person has the proper tech skills.

@Question2
Copy link
Author

Hmm, in the warehouse, i was simply clicking the "do task" button without checking which tech was going to be assigned (since i pretty much have all elite techs anyway). I guess at some point Cpt Travis Riviera (a vessel gunner) got selected. Not sure why he would show in the list of techs for the warehouse though, if hes a vessel gunner.

@arlith
Copy link
Contributor

arlith commented Mar 21, 2016

I think that, for large craft, the crew performs repairs/maintenance. That may be how this came about, I dunno if the code around repairing/maintaining large craft is fully implemented.

@Dylan-M
Copy link
Contributor

Dylan-M commented Mar 21, 2016

Not quite, there is an "Engineer" for vessels.

@Akjosch
Copy link
Contributor

Akjosch commented Mar 21, 2016

Manually removing the repair job from the cpnx file allows the day to advance normally and without any errors in log.

This doesn't fix the issue; it just lets Question2 play the game.

battletech.zip

@Question2
Copy link
Author

Thanks for the help!

@Akjosch
Copy link
Contributor

Akjosch commented Mar 30, 2016

So ... try as I might, I still didn't manage to replicate the behaviour. Anybody has any more luck?

At best, we can add some extra checks to make sure nobody with no tech skills gets assigned and that a day gets passed (with an automatic failure) if a broken save game includes such.

@Dylan-M
Copy link
Contributor

Dylan-M commented Mar 30, 2016

If we add such extra checks, I'd rather that on campaign loading that person got un-assigned from the repair. Or if it's difficult on loading, then on the advance day checks for repairs.

As for how this can happen? It's easy: Have a tech skill on someone, assign them to a repair, and then remove the tech skill from them. Whups!

@Dylan-M Dylan-M added the Bug label Mar 30, 2016
@Akjosch
Copy link
Contributor

Akjosch commented Mar 30, 2016

Well, a fix-at-load-time check won't help us with people messing up their game state by abusing the GM tools ...

Akjosch added a commit that referenced this issue Mar 30, 2016
@Akjosch
Copy link
Contributor

Akjosch commented Mar 30, 2016

Added an NPE guard in newDay() and a report line stating that the non-tech was removed from repairing the part.

@Akjosch Akjosch closed this as completed Mar 30, 2016
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

4 participants