From 9eab3b172824e3c2afabf8c03ece45d7d2d49606 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 6 Jun 2016 01:04:14 +0200 Subject: [PATCH] Fix crash in race dialog when no head or hair are available --- apps/openmw/mwgui/race.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index aa229de72..6c08f7dc1 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -326,8 +326,11 @@ namespace MWGui record.mRace = mCurrentRaceId; record.setIsMale(mGenderIndex == 0); - record.mHead = mAvailableHeads[mFaceIndex]; - record.mHair = mAvailableHairs[mHairIndex]; + if (mFaceIndex >= 0 && mFaceIndex < int(mAvailableHeads.size())) + record.mHead = mAvailableHeads[mFaceIndex]; + + if (mHairIndex >= 0 && mHairIndex < int(mAvailableHairs.size())) + record.mHair = mAvailableHairs[mHairIndex]; try {