Fix crash in character preview for non-existing meshes (Fixes #2128)

report
scrawl 10 years ago
parent 75b0da5dce
commit fee08f97ed

@ -313,7 +313,15 @@ namespace MWGui
record.mHead = mAvailableHeads[mFaceIndex];
record.mHair = mAvailableHairs[mHairIndex];
mPreview->setPrototype(record);
try
{
mPreview->setPrototype(record);
}
catch (std::exception& e)
{
std::cerr << "Error creating preview: " << e.what() << std::endl;
}
mPreviewDirty = true;
}

@ -115,8 +115,8 @@ namespace MWRender
void CharacterPreview::rebuild()
{
assert(mAnimation);
delete mAnimation;
mAnimation = NULL;
mAnimation = new NpcAnimation(mCharacter, mNode,
0, true, true, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));
@ -187,6 +187,9 @@ namespace MWRender
void InventoryPreview::update()
{
if (!mAnimation)
return;
mAnimation->updateParts();
MWWorld::InventoryStore &inv = mCharacter.getClass().getInventoryStore(mCharacter);

@ -676,7 +676,15 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
removeIndividualPart(type);
mPartslots[type] = group;
mPartPriorities[type] = priority;
mObjectParts[type] = insertBoundedPart(mesh, group, sPartList.at(type), enchantedGlow, glowColor);
try
{
mObjectParts[type] = insertBoundedPart(mesh, group, sPartList.at(type), enchantedGlow, glowColor);
}
catch (std::exception& e)
{
std::cerr << "Error adding NPC part: " << e.what() << std::endl;
return false;
}
if (!mSoundsDisabled)
{

Loading…
Cancel
Save