Skip to content

Commit

Permalink
- Fix crash that happen when Unit using DroppodLocomotor because …
Browse files Browse the repository at this point in the history
…of `DroppodType` is exclusive to `Infantry`

- Fix crash when `TypeConvertGroup::Convert` is called with `nullptr` Owner and get checked with `EnumFunctions::CanTargetHouse`
  • Loading branch information
Otamaa committed Mar 23, 2024
1 parent 477ee2a commit 26f1b8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DroppodTypeClass>();
this->DroppodType->LoadFromINI(pINI, pSection);
}
else
{
this->DroppodType.reset();
}
if (this->DroppodType == nullptr)
this->DroppodType = std::make_unique<DroppodTypeClass>();

this->DroppodType->LoadFromINI(pINI, pSection);
}

template <typename T>
Expand Down
2 changes: 1 addition & 1 deletion src/New/Type/Affiliated/TypeConvertGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void TypeConvertGroup::Convert(FootClass* pTargetFoot, const std::vector<TypeCon
{
if (!toType.isset() || !toType.Get()) continue;

if (!EnumFunctions::CanTargetHouse(affectedHouses, pOwner, pTargetFoot->Owner))
if (pOwner && !EnumFunctions::CanTargetHouse(affectedHouses, pOwner, pTargetFoot->Owner))
continue;

if (fromTypes.size())
Expand Down

0 comments on commit 26f1b8a

Please sign in to comment.