From 26f1b8a5e81c86c4ea5a8f92445283d13e09c52f Mon Sep 17 00:00:00 2001 From: Otamaa Date: Sat, 23 Mar 2024 16:32:07 +0700 Subject: [PATCH] - Fix crash that happen when `Unit` using `DroppodLocomotor` because of `DroppodType` is exclusive to `Infantry` - Fix crash when `TypeConvertGroup::Convert` is called with `nullptr` Owner and get checked with `EnumFunctions::CanTargetHouse` --- src/Ext/TechnoType/Body.cpp | 14 ++++---------- src/New/Type/Affiliated/TypeConvertGroup.cpp | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Ext/TechnoType/Body.cpp b/src/Ext/TechnoType/Body.cpp index 41cba2c52a..272f923ffa 100644 --- a/src/Ext/TechnoType/Body.cpp +++ b/src/Ext/TechnoType/Body.cpp @@ -407,16 +407,10 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->InterceptorType.reset(); } - if (this->OwnerObject()->WhatAmI() == AbstractType::InfantryType) - { - if (this->DroppodType == nullptr) - this->DroppodType = std::make_unique(); - this->DroppodType->LoadFromINI(pINI, pSection); - } - else - { - this->DroppodType.reset(); - } + if (this->DroppodType == nullptr) + this->DroppodType = std::make_unique(); + + this->DroppodType->LoadFromINI(pINI, pSection); } template diff --git a/src/New/Type/Affiliated/TypeConvertGroup.cpp b/src/New/Type/Affiliated/TypeConvertGroup.cpp index 9cd91be5c7..d0ce1a70ee 100644 --- a/src/New/Type/Affiliated/TypeConvertGroup.cpp +++ b/src/New/Type/Affiliated/TypeConvertGroup.cpp @@ -7,7 +7,7 @@ void TypeConvertGroup::Convert(FootClass* pTargetFoot, const std::vectorOwner)) + if (pOwner && !EnumFunctions::CanTargetHouse(affectedHouses, pOwner, pTargetFoot->Owner)) continue; if (fromTypes.size())