mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-13 11:30:44 +00:00
- SW: avoid crashing when unwinding from a savegame loading error.
The linked list may be incomplete in this case. Also kept the macro unmangling done to debug this code.
This commit is contained in:
parent
3c3da13d3f
commit
e13426ec6e
2 changed files with 8 additions and 4 deletions
|
@ -56,9 +56,11 @@ typedef
|
|||
((LIST) list)->Prev = (LIST) nodep, \
|
||||
((LIST) nodep)->Prev->Next = (LIST) nodep)
|
||||
|
||||
#define REMOVE(nodep) ( ((LIST) nodep)->Prev->Next = ((LIST) nodep)->Next, \
|
||||
((LIST) nodep)->Next->Prev = ((LIST) nodep)->Prev)
|
||||
|
||||
inline void REMOVE(PANEL_SPRITEp nodep)
|
||||
{
|
||||
nodep->Prev->Next = nodep->Next;
|
||||
nodep->Next->Prev = nodep->Prev;
|
||||
}
|
||||
|
||||
#define TRAVERSE(l, o, n) ASSERT(((LIST)l)->Next && ((LIST)l)->Prev); for (o = (decltype(o))(((LIST)l)->Next); \
|
||||
n = o->Next, (LIST) o != (LIST) l; \
|
||||
|
|
|
@ -6513,9 +6513,11 @@ void
|
|||
pClearSpriteList(PLAYERp pp)
|
||||
{
|
||||
PANEL_SPRITEp psp=nullptr, next_psp=nullptr;
|
||||
auto l = &pp->PanelSpriteList;
|
||||
|
||||
TRAVERSE(&pp->PanelSpriteList, psp, next_psp)
|
||||
for (psp = l->Next; next_psp = psp->Next, (LIST)psp != (LIST)l; psp = next_psp)
|
||||
{
|
||||
if (psp->Next == nullptr || psp->Prev == nullptr) return; // this can happen when cleaning up a fatal error.
|
||||
pKillSprite(psp);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue