Fixed possible crash in mission generation when generating a mission with a faction that doesn't have mandpad and with the disabled infantry option checked.

This commit is contained in:
Khopa 2020-12-12 15:27:36 +01:00
parent bfa0e4ba49
commit 31fdd24c3e

View File

@ -194,7 +194,9 @@ class GroundConflictGenerator:
if self.game.settings.manpads:
# 50% of armored units protected by manpad
if random.choice([True, False]):
u = random.choice(db.find_manpad(faction))
manpads = db.find_manpad(faction)
if len(manpads) > 0:
u = random.choice(manpads)
self.mission.vehicle_group(
side,
namegen.next_infantry_name(side, cp, u), u,