From 9abf9abe9d210d3f9fd0d91d640b2d713dd6b63f Mon Sep 17 00:00:00 2001 From: KJeff01 Date: Sun, 18 Feb 2024 19:53:38 -0600 Subject: [PATCH] Check for nullptr/dead lassat in countUpdate() --- src/loop.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/loop.cpp b/src/loop.cpp index 9d64d8759b8..71d505b1917 100644 --- a/src/loop.cpp +++ b/src/loop.cpp @@ -460,7 +460,11 @@ void countUpdate(bool synch) setLasSatExists(false, i); for (const STRUCTURE *psCBuilding : apsStructLists[i]) { - if (psCBuilding->pStructureType->type == REF_SAT_UPLINK && psCBuilding->status == SS_BUILT) + if (psCBuilding == nullptr || isDead(psCBuilding)) + { + continue; + } + if (psCBuilding->pStructureType && psCBuilding->pStructureType->type == REF_SAT_UPLINK && psCBuilding->status == SS_BUILT) { setSatUplinkExists(true, i); } @@ -472,7 +476,11 @@ void countUpdate(bool synch) } for (const STRUCTURE *psCBuilding : mission.apsStructLists[i]) { - if (psCBuilding->pStructureType->type == REF_SAT_UPLINK && psCBuilding->status == SS_BUILT) + if (psCBuilding == nullptr || isDead(psCBuilding)) + { + continue; + } + if (psCBuilding->pStructureType && psCBuilding->pStructureType->type == REF_SAT_UPLINK && psCBuilding->status == SS_BUILT) { setSatUplinkExists(true, i); }