File tree 1 file changed +9
-1
lines changed
MekHQ/src/mekhq/campaign/autoresolve/converter
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 32
32
import megamek .common .strategicBattleSystems .BaseFormationConverter ;
33
33
import megamek .common .strategicBattleSystems .SBFUnit ;
34
34
import megamek .common .strategicBattleSystems .SBFUnitConverter ;
35
+ import megamek .logging .MMLogger ;
35
36
import mekhq .campaign .autoresolve .acar .SimulationContext ;
36
37
import mekhq .campaign .autoresolve .component .Formation ;
37
38
38
39
import java .util .ArrayList ;
39
40
40
41
public class ForceToFormationConverter extends BaseFormationConverter <Formation > {
42
+ private static final MMLogger logger = MMLogger .create (ForceToFormationConverter .class );
41
43
42
44
public ForceToFormationConverter (Force force , SimulationContext game ) {
43
45
super (force , game , new Formation ());
@@ -50,7 +52,13 @@ public Formation convert() {
50
52
var thisUnit = new ArrayList <AlphaStrikeElement >();
51
53
for (ForceAssignable entity : forces .getFullEntities (subforce )) {
52
54
if (entity instanceof Entity entityCast ) {
53
- thisUnit .add (ASConverter .convertAndKeepRefs (entityCast ));
55
+ var element = ASConverter .convertAndKeepRefs (entityCast );
56
+ if (element != null ) {
57
+ thisUnit .add (element );
58
+ } else {
59
+ var msg = String .format ("Could not convert entity %s to AS element" , entityCast );
60
+ logger .error (msg );
61
+ }
54
62
}
55
63
}
56
64
SBFUnit convertedUnit = new SBFUnitConverter (thisUnit , subforce .getName (), report ).createSbfUnit ();
You can’t perform that action at this time.
0 commit comments