- fixed some more potential NULL pointer accesses.

SVN r3286 (trunk)
This commit is contained in:
Christoph Oelckers 2011-08-31 06:14:28 +00:00
parent f2a457206c
commit 5747406776
2 changed files with 23 additions and 20 deletions

View file

@ -266,9 +266,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
self->x + (((pr_freeze()-128)*self->radius)>>7),
self->y + (((pr_freeze()-128)*self->radius)>>7),
self->z + (pr_freeze()*self->height/255), ALLOW_REPLACE);
mo->SetState (mo->SpawnState + (pr_freeze()%3));
if (mo)
{
mo->SetState (mo->SpawnState + (pr_freeze()%3));
mo->velz = FixedDiv(mo->z - self->z, self->height)<<2;
mo->velx = pr_freeze.Random2 () << (FRACBITS-7);
mo->vely = pr_freeze.Random2 () << (FRACBITS-7);
@ -281,24 +281,27 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
{ // attach the player's view to a chunk of ice
AActor *head = Spawn("IceChunkHead", self->x, self->y,
self->z + self->player->mo->ViewHeight, ALLOW_REPLACE);
head->velz = FixedDiv(head->z - self->z, self->height)<<2;
head->velx = pr_freeze.Random2 () << (FRACBITS-7);
head->vely = pr_freeze.Random2 () << (FRACBITS-7);
head->health = self->health;
head->angle = self->angle;
if (head->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
if (head != NULL)
{
head->player = self->player;
head->player->mo = static_cast<APlayerPawn*>(head);
self->player = NULL;
head->ObtainInventory (self);
}
head->pitch = 0;
head->RenderStyle = self->RenderStyle;
head->alpha = self->alpha;
if (head->player->camera == self)
{
head->player->camera = head;
head->velz = FixedDiv(head->z - self->z, self->height)<<2;
head->velx = pr_freeze.Random2 () << (FRACBITS-7);
head->vely = pr_freeze.Random2 () << (FRACBITS-7);
head->health = self->health;
head->angle = self->angle;
if (head->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
{
head->player = self->player;
head->player->mo = static_cast<APlayerPawn*>(head);
self->player = NULL;
head->ObtainInventory (self);
}
head->pitch = 0;
head->RenderStyle = self->RenderStyle;
head->alpha = self->alpha;
if (head->player->camera == self)
{
head->player->camera = head;
}
}
}

View file

@ -647,10 +647,10 @@ AInventory *AInventory::CreateTossable ()
{
copy->MaxAmount = MaxAmount;
copy->Amount = 1;
copy->DropTime = 30;
copy->flags &= ~(MF_SPECIAL|MF_SOLID);
Amount--;
}
copy->DropTime = 30;
copy->flags &= ~(MF_SPECIAL|MF_SOLID);
return copy;
}