1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-03 16:45:34 +00:00

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

This commit is contained in:
scrawl 2014-12-03 00:02:14 +01:00
parent 75b0da5dce
commit fee08f97ed
3 changed files with 22 additions and 3 deletions

View file

@ -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;
}

View file

@ -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);

View file

@ -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)
{