- Fixed: FDecalGroup::GetDecal() crashed if there were no decals defined for the group.

SVN r3705 (trunk)
This commit is contained in:
Randy Heit 2012-06-22 03:30:57 +00:00
parent 8bbe241dcf
commit c53c14b8c6
2 changed files with 10 additions and 7 deletions

View file

@ -1121,16 +1121,19 @@ FDecalLib::FTranslation *FDecalLib::FTranslation::LocateTranslation (DWORD start
const FDecalTemplate *FDecalGroup::GetDecal () const
{
const FDecalBase *decal = Choices.PickEntry ();
const FDecalBase *remember;
const FDecalBase *remember = decal;
// Repeatedly GetDecal() until the result is constant, since
// the choice might be another FDecalGroup.
do
if (decal != NULL)
{
remember = decal;
decal = decal->GetDecal ();
} while (decal != remember);
return static_cast<const FDecalTemplate *>(decal);
do
{
remember = decal;
decal = decal->GetDecal ();
} while (decal != NULL && decal != remember);
}
return static_cast<const FDecalTemplate *>(remember);
}
FDecalAnimator::FDecalAnimator (const char *name)

View file

@ -111,7 +111,7 @@ T TWeightedList<T>::PickEntry () const
{
choice = choice->Next;
}
return choice->Value;
return choice != NULL ? choice->Value : NULL;
}
template<class T>