Skip to content

Commit

Permalink
Handle case in the editor when actor's bodypart was not found
Browse files Browse the repository at this point in the history
  • Loading branch information
akortunov committed Nov 8, 2018
1 parent c114e12 commit fa437cb
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions apps/opencs/model/world/actoradapter.cpp
Expand Up @@ -113,17 +113,23 @@ namespace CSMWorld
const std::string ActorAdapter::ActorData::getPart(ESM::PartReferenceType index) const
{
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
const std::string femalePart = mRaceData->getFemalePart(index);
if (!femalePart.empty())
return femalePart;
if (mFemale)
{
// Note: we should use male parts for females as fallback
const std::string femalePart = mRaceData->getFemalePart(index);
if (!femalePart.empty())
return femalePart;
}

return mRaceData->getMalePart(index);
}

return mRaceData->getMalePart(index);
const std::string& partName = "";
return partName;
}

const std::string& partName = it->second.first;
Expand Down

0 comments on commit fa437cb

Please sign in to comment.