From b04e743236da9e9ee610adb4ef6dc6805b2498ea Mon Sep 17 00:00:00 2001 From: helixhorned Date: Tue, 14 Feb 2012 23:14:07 +0000 Subject: [PATCH] Fix use of an uninitialized variable in P_FindWall->FindDistance2D with noclip. git-svn-id: https://svn.eduke32.com/eduke32@2344 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/sector.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 4c065e5aa..dfc7f851a 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -3046,6 +3046,8 @@ static int32_t P_FindWall(DukePlayer_t *p,int16_t *hitw) 0,&hitinfo,CLIPMASK0); *hitw = hitinfo.hitwall; + if (hitinfo.hitwall < 0) + return INT32_MAX; return (FindDistance2D(hitinfo.pos.x-p->pos.x,hitinfo.pos.y-p->pos.y)); } @@ -3145,7 +3147,7 @@ void P_CheckSectors(int32_t snum) i = P_FindWall(p,&hitscanwall); - if (i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR) + if (hitscanwall >= 0 && i < 1280 && wall[hitscanwall].overpicnum == MIRROR) if (wall[hitscanwall].lotag > 0 && !A_CheckSoundPlaying(p->i,wall[hitscanwall].lotag) && snum == screenpeek) { A_PlaySound(wall[hitscanwall].lotag,p->i);