From af84c42f714484e196cf0d82f9c296e3567b5f35 Mon Sep 17 00:00:00 2001 From: Casper Talvio Date: Tue, 2 Jan 2024 23:24:14 +0200 Subject: [PATCH] Add validity check to `HandleDistanceAndTimeStats_Threaded` to prevent crash (#767) --- Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut index f31802142..101d5e4ef 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_stats.nut @@ -931,6 +931,9 @@ void function HandleDistanceAndTimeStats_Threaded() // track distance stats foreach ( entity player in GetPlayerArray() ) { + if ( !IsValid( player ) ) + continue + if ( player.p.lastPosForDistanceStatValid ) { // not 100% sure on using Distance2D over Distance tbh