From 0065bccf24cbc226981264960770fa82843d6807 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 8 Nov 2018 11:47:41 +0400 Subject: [PATCH] Handle case in the editor when actor's bodypart was not found --- apps/opencs/model/world/actoradapter.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/opencs/model/world/actoradapter.cpp b/apps/opencs/model/world/actoradapter.cpp index ea40a1f8dd..b89240a80f 100644 --- a/apps/opencs/model/world/actoradapter.cpp +++ b/apps/opencs/model/world/actoradapter.cpp @@ -113,17 +113,22 @@ 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); + return ""; } const std::string& partName = it->second.first;