1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-03 20:49:41 +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.mHead = mAvailableHeads[mFaceIndex];
record.mHair = mAvailableHairs[mHairIndex]; 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; mPreviewDirty = true;
} }

View file

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

View file

@ -676,7 +676,15 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
removeIndividualPart(type); removeIndividualPart(type);
mPartslots[type] = group; mPartslots[type] = group;
mPartPriorities[type] = priority; 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) if (!mSoundsDisabled)
{ {