Fix segfault when spectating on an Emerald Hunt map

This commit is contained in:
Gustaf Alhäll 2023-08-12 12:31:59 +02:00
parent 3fbdaa61b7
commit 3d14d155e0
No known key found for this signature in database
GPG key ID: 6C1F67D690CDEDFD

View file

@ -2512,6 +2512,8 @@ num:
static INT32 ST_drawEmeraldHuntIcon(mobj_t *hunt, patch_t **patches, INT32 offset)
{
INT32 interval, i;
if (stplyr->mo == NULL)
return 0; // player just joined after spectating, can happen on custom gamemodes.
UINT32 dist = ((UINT32)P_AproxDistance(P_AproxDistance(stplyr->mo->x - hunt->x, stplyr->mo->y - hunt->y), stplyr->mo->z - hunt->z))>>FRACBITS;
if (dist < 128)