From 4c4736113251cd0c4fdbdfe39a98da878e25ce34 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 10 May 2020 22:30:23 +0200 Subject: [PATCH] - added null check to findplayer. --- source/games/duke/src/sectors.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 7dd45685b..733243cd1 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -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; }