Skip to content

Commit

Permalink
Check for nullptr/dead lassat in countUpdate()
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed Feb 19, 2024
1 parent a03c532 commit 9abf9ab
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 9abf9ab

Please sign in to comment.