- Duke: added some null pointer checks.

This commit is contained in:
Christoph Oelckers 2021-12-07 17:09:28 +01:00
parent 42e4e9288f
commit 5d09748af9
4 changed files with 8 additions and 7 deletions

View file

@ -245,10 +245,9 @@ void insertspriteq(DDukeActor* const actor)
{
if (spriteq[spriteqloc] != nullptr)
{
// Why is this not deleted here?
// Also todo: Make list size a CVAR.
// todo: Make list size a CVAR.
spriteq[spriteqloc]->s->xrepeat = 0;
// deletesprite(spriteq[spriteqloc]);
deletesprite(spriteq[spriteqloc]);
}
spriteq[spriteqloc] = actor;
spriteqloc = (spriteqloc + 1) % spriteqamount;
@ -779,7 +778,8 @@ void movecrane(DDukeActor *actor, int crane)
else if (t[0] == 9)
t[0] = 0;
SetActor(cpt.poleactor, { spri->x, spri->y, spri->z - (34 << 8) });
if (cpt.poleactor)
SetActor(cpt.poleactor, { spri->x, spri->y, spri->z - (34 << 8) });
auto Owner = actor->GetOwner();
if (Owner != nullptr || actor->IsActiveCrane())

View file

@ -248,14 +248,14 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
continue;
case VIEWSCREEN:
case VIEWSCREEN2:
if (camsprite != nullptr && h->GetHitOwner()->temp_data[0] == 1)
if (camsprite != nullptr && h->GetHitOwner() && h->GetHitOwner()->temp_data[0] == 1)
{
t->picnum = STATIC;
t->cstat |= (rand() & 12);
t->xrepeat += 8;
t->yrepeat += 8;
}
else if (camsprite == h->GetHitOwner())
else if (camsprite && camsprite == h->GetHitOwner())
{
t->picnum = TILE_VIEWSCR;
}

View file

@ -113,7 +113,7 @@ public:
{
UnloadSound(schan->SoundID);
currentCommentarySound = 0;
currentCommentarySprite->s->picnum = DEVELOPERCOMMENTARY;
if (currentCommentarySprite) currentCommentarySprite->s->picnum = DEVELOPERCOMMENTARY;
I_SetRelativeVolume(1.0f);
UnmuteSounds();
}

View file

@ -500,6 +500,7 @@ void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE)
apt.x = sp->x;
apt.y = sp->y;
apt.z = sp->z;
apt.poleactor = nullptr;
DukeStatIterator it(STAT_DEFAULT);
while (auto act = it.Next())