Merge pull request #2029 from akortunov/actorfix

[Regression] Handle case in the editor when actor's bodypart was not found
pull/541/head
Bret Curtis 6 years ago committed by GitHub
commit 194232abde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -113,17 +113,22 @@ namespace CSMWorld
const std::string ActorAdapter::ActorData::getPart(ESM::PartReferenceType index) const const std::string ActorAdapter::ActorData::getPart(ESM::PartReferenceType index) const
{ {
auto it = mParts.find(index); auto it = mParts.find(index);
if (it == mParts.end() && mRaceData && mRaceData->handlesPart(index)) if (it == mParts.end())
{ {
if (mFemale) if (mRaceData && mRaceData->handlesPart(index))
{ {
// Note: we should use male parts for females as fallback if (mFemale)
const std::string femalePart = mRaceData->getFemalePart(index); {
if (!femalePart.empty()) // Note: we should use male parts for females as fallback
return femalePart; const std::string femalePart = mRaceData->getFemalePart(index);
if (!femalePart.empty())
return femalePart;
}
return mRaceData->getMalePart(index);
} }
return mRaceData->getMalePart(index); return "";
} }
const std::string& partName = it->second.first; const std::string& partName = it->second.first;

Loading…
Cancel
Save