From 42a04de37c0b9bc042bddc9a55ea9b5a9fdbb6e2 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 4 Mar 2017 21:05:12 +0100 Subject: [PATCH] Fix a crash that occurred when a carried light fails to be attached. --- apps/openmw/mwrender/npcanimation.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 9a3cd5611..87b6ae2bc 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -625,7 +625,8 @@ void NpcAnimation::updateParts() const ESM::Light *light = part.get()->mBase; addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1, "meshes\\"+light->mModel); - addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), light); + if (mObjectParts[ESM::PRT_Shield]) + addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), light); } } @@ -920,7 +921,7 @@ void NpcAnimation::showCarriedLeft(bool show) if (addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1, mesh, !iter->getClass().getEnchantment(*iter).empty(), &glowColor)) { - if (iter->getTypeName() == typeid(ESM::Light).name()) + if (iter->getTypeName() == typeid(ESM::Light).name() && mObjectParts[ESM::PRT_Shield]) addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), iter->get()->mBase); } }