@@ -108,8 +108,8 @@ public class MekHQ implements GameListener {
108
108
109
109
// region Variable Declarations
110
110
private static final SuitePreferences mhqPreferences = new SuitePreferences ();
111
- private static final MHQOptions mhqOptions = new MHQOptions ();
112
- private static final EventBus EVENT_BUS = new EventBus ();
111
+ private static final MHQOptions mhqOptions = new MHQOptions ();
112
+ private static final EventBus EVENT_BUS = new EventBus ();
113
113
114
114
private static ObservableString selectedTheme ;
115
115
@@ -124,21 +124,21 @@ public class MekHQ implements GameListener {
124
124
private static ObservableString financesDirectory ;
125
125
126
126
// stuff related to MM games
127
- private Server myServer = null ;
128
- private GameThread gameThread = null ;
129
- private Scenario currentScenario = null ;
130
- private Client client = null ;
127
+ private Server myServer = null ;
128
+ private GameThread gameThread = null ;
129
+ private Scenario currentScenario = null ;
130
+ private Client client = null ;
131
131
132
132
// the actual campaign - this is where the good stuff is
133
133
private CampaignController campaignController ;
134
- private CampaignGUI campaignGUI ;
134
+ private CampaignGUI campaignGUI ;
135
135
136
136
private final IconPackage iconPackage = new IconPackage ();
137
137
138
- private final IAutosaveService autosaveService ;
138
+ private final IAutosaveService autosaveService ;
139
139
// endregion Variable Declarations
140
140
private static final SanityInputFilter sanityInputFilter = new SanityInputFilter ();
141
- private static final String defaultTheme = "com.formdev.flatlaf.FlatDarculaLaf" ;
141
+ private static final String defaultTheme = "com.formdev.flatlaf.FlatDarculaLaf" ;
142
142
143
143
public static SuitePreferences getMHQPreferences () {
144
144
return mhqPreferences ;
@@ -318,9 +318,9 @@ public static void main(String... args) {
318
318
319
319
// First, create a global default exception handler
320
320
Thread .setDefaultUncaughtExceptionHandler ((thread , t ) -> {
321
- final String name = t .getClass ().getName ();
321
+ final String name = t .getClass ().getName ();
322
322
final String message = String .format (MMLoggingConstants .UNHANDLED_EXCEPTION , name );
323
- final String title = String .format (MMLoggingConstants .UNHANDLED_EXCEPTION_TITLE , name );
323
+ final String title = String .format (MMLoggingConstants .UNHANDLED_EXCEPTION_TITLE , name );
324
324
logger .errorDialog (t , message , title );
325
325
});
326
326
@@ -390,9 +390,9 @@ public void joinGame(Scenario scenario, List<Unit> meks) {
390
390
return ;
391
391
}
392
392
393
- final String playerName = joinGameDialog .getPlayerName ();
393
+ final String playerName = joinGameDialog .getPlayerName ();
394
394
final String serverAddress = joinGameDialog .getServerAddress ();
395
- final int port = joinGameDialog .getPort ();
395
+ final int port = joinGameDialog .getPort ();
396
396
joinGameDialog .dispose ();
397
397
398
398
try {
@@ -443,11 +443,11 @@ public void startHost(Scenario scenario, boolean loadSavegame, List<Unit> meks,
443
443
444
444
this .autosaveService .requestBeforeMissionAutosave (getCampaign ());
445
445
446
- final String playerName = hostDialog .getPlayerName ();
447
- final String password = hostDialog .getServerPass ();
448
- final int port = hostDialog .getPort ();
449
- final boolean register = hostDialog .isRegister ();
450
- final String metaserver = register ? hostDialog .getMetaserver () : "" ;
446
+ final String playerName = hostDialog .getPlayerName ();
447
+ final String password = hostDialog .getServerPass ();
448
+ final int port = hostDialog .getPort ();
449
+ final boolean register = hostDialog .isRegister ();
450
+ final String metaserver = register ? hostDialog .getMetaserver () : "" ;
451
451
452
452
// Force cleanup of the current modal, since we are (possibly) about to display a new one and macOS seems to
453
453
// struggle with that (see https://github.com/MegaMek/mekhq/issues/953)
@@ -583,7 +583,7 @@ public void gameVictory(PostGameResolution gve) {
583
583
BattlefieldControlType battlefieldControl = template .getBattlefieldControl ();
584
584
585
585
String controlMessage = MHQInternationalization .getText ("ResolveDialog.control." +
586
- battlefieldControl .name ());
586
+ battlefieldControl .name ());
587
587
588
588
victoryMessage = String .format ("%s\n \n %s" , controlMessage , victoryMessage );
589
589
}
@@ -632,7 +632,7 @@ public void resolveScenario(Scenario selectedScenario) {
632
632
BattlefieldControlType battlefieldControl = template .getBattlefieldControl ();
633
633
634
634
String controlMessage = MHQInternationalization .getText ("ResolveDialog.control." +
635
- battlefieldControl .name ());
635
+ battlefieldControl .name ());
636
636
637
637
victoryMessage = String .format ("%s\n \n %s" , controlMessage , victoryMessage );
638
638
}
@@ -763,7 +763,7 @@ public void autoResolveConcluded(AutoResolveConcludedEvent autoResolveConcludedE
763
763
BattlefieldControlType battlefieldControl = template .getBattlefieldControl ();
764
764
765
765
String controlMessage = MHQInternationalization .getText ("ResolveDialog.control." +
766
- battlefieldControl .name ());
766
+ battlefieldControl .name ());
767
767
768
768
victoryMessage = String .format ("%s\n \n %s\n \n %s" , controlMessage , victoryMessage , decisionMessage );
769
769
}
@@ -787,6 +787,13 @@ public void autoResolveConcluded(AutoResolveConcludedEvent autoResolveConcludedE
787
787
if (resolveDialog .wasAborted ()) {
788
788
for (UUID personId : tracker .getPeopleStatus ().keySet ()) {
789
789
Person person = getCampaign ().getPerson (personId );
790
+
791
+ if (person == null ) {
792
+ throw new IllegalArgumentException ("Person with ID " +
793
+ personId +
794
+ " does not exist in the campaign" );
795
+ }
796
+
790
797
person .setHits (person .getHitsPrior ());
791
798
}
792
799
return ;
0 commit comments