- added null check to findplayer.

This commit is contained in:
Christoph Oelckers 2020-05-10 22:30:23 +02:00
parent 577a800843
commit 4c47361132

View file

@ -299,7 +299,7 @@ int findplayer(const spritetype* s, int* d)
if (ud.multimode < 2)
{
*d = abs(ps[myconnectindex].oposx - s->x) + abs(ps[myconnectindex].oposy - s->y) + ((abs(ps[myconnectindex].oposz - s->z + (28 << 8))) >> 4);
if (d) *d = abs(ps[myconnectindex].oposx - s->x) + abs(ps[myconnectindex].oposy - s->y) + ((abs(ps[myconnectindex].oposz - s->z + (28 << 8))) >> 4);
return myconnectindex;
}
@ -316,7 +316,7 @@ int findplayer(const spritetype* s, int* d)
}
}
*d = closest;
if (d) *d = closest;
return closest_player;
}