Skip to content

Conversation

Copy link

Copilot AI commented Jan 19, 2026

Several functions in Team/Body.cpp access pObject->Owner->Type->MultiplayPassive without null-checking pObject->Owner first, risking null pointer dereference.

Changes

  • Added || !pObject->Owner guard to the existing IsAlive check in:
    • HouseOwns
    • EnemyOwns
    • NeutralOwns
    • HouseOwnsAll
    • NeutralOwnsAll

The EnemyOwnsAll function already had this pattern implemented.

// Before
if (!TechnoExtData::IsAlive(pObject))
    continue;

// After
if (!TechnoExtData::IsAlive(pObject) || !pObject->Owner)
    continue;
Original prompt

give null checks in Team/Body.cpp


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: deathreaperz <37824218+deathreaperz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add null checks in Team/Body.cpp Add null checks for pObject->Owner in Team/Body.cpp Jan 19, 2026
Copilot AI requested a review from deathreaperz January 19, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants