Announcement

Collapse
No announcement yet.

[DEBUG] Player Null Crash

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [DEBUG] Player Null Crash

    Regarding this:


    From this problem:





    Originally posted by E
    putting a
    Code:
    if (g_player[m_owner] != NULL) {
    doesn't work either. But this code used to work before 709 so I think a MSVC6++ compatibility was broken. Fortunately this crash can be avoided by having the userprofile for sectarianhappiness to be off. But this line is the same as cultureonly units and other stuff throughout the code so something is broken.
    g_player[m_owner] being NULL would make g_player[m_owner]->GetCivilisation()->GetCityStyle() crash, but there are more possibilities.
    Use the debugger to check if maybe
    • m_owner is "invalid" (e.g. PLAYER_UNASSIGNED)
    • g_player[m_owner] is OK, but GetCivilisation returns NULL
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

  • #2
    My first issue is that this code worked before. Andeven now my citystyleonly code works for CanBuildUnit so why is it crashing here?

    second issue:
    Should I just add m_owner > 0 and != Null and civilisation != Null and m_citystyle != Null?

    I havent tried it but there has to be a better way to do this.

    Thanks.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

    Comment

    Working...
    X