mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Fixed: FDecalGroup::GetDecal() crashed if there were no decals defined for the group.
SVN r3705 (trunk)
This commit is contained in:
parent
8bbe241dcf
commit
c53c14b8c6
2 changed files with 10 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -111,7 +111,7 @@ T TWeightedList<T>::PickEntry () const
|
|||
{
|
||||
choice = choice->Next;
|
||||
}
|
||||
return choice->Value;
|
||||
return choice != NULL ? choice->Value : NULL;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
|
Loading…
Reference in a new issue