Skip to content

Fix RvR campaign startup failing, leaving every battlefront locked - #180

Open
Chris443C wants to merge 1 commit into
Shmerrick:masterfrom
Chris443C:fix/rvr-campaign-startup
Open

Fix RvR campaign startup failing, leaving every battlefront locked#180
Chris443C wants to merge 1 commit into
Shmerrick:masterfrom
Chris443C:fix/rvr-campaign-startup

Conversation

@Chris443C

Copy link
Copy Markdown

BattlefieldObjective.RemoveGlow() dereferences Region, which is => Zone?.Region and is therefore null for objectives constructed by LoadObjectives that were never added to a zone. Startup locking walks exactly those, so the NRE propagates out of LockBattleFrontsAllRegions.

NullReferenceException
   at BattlefieldObjective.RemoveGlow()
   at BattlefieldObjective.SetObjectiveLocked()
   at UpperTierCampaignManager.LockBattleFrontsAllRegions(4)
   at Core.Main

Why this is worse than it looks

The throw happens during LockBattleFrontsAllRegions, so OpenActiveBattlefront never runs. Every battlefront stays locked. Then at runtime, GetActiveBattleFrontStatus calls .Single() on an empty set:

WARN  Campaign.GetActiveBattleFrontStatus :: ALL BF Statuses are LOCKED
      : Sequence contains no matching element
ERROR EXCEPTION: <player> in Region 11 - StateMachineException:
      No exception listener is registered

The objective's state machine has no exception listener, so it dies there and objectives never progress past capture.

The symptom surfaces hours after the single startup line that explains it, which is what makes it hard to attribute — it presents as "battlefield objectives don't work" rather than as a startup failure.

The fix

Guard the null. Locking then completes, OpenActiveBattlefront runs, and the campaign initialises.

Verification

Before, on every boot:

Locking Battlefronts
(no "Opening Active battlefronts" - the exception aborted it)

After:

Locking Battlefronts
Opening Active battlefronts
UpperTierCampaignManager.OpenActiveBattlefront :: Unlocking objectives Empire/Chaos Tier 4 BF Id : 2
LowerTierCampaignManager.OpenActiveBattlefront :: Unlocking objectives Empire/Chaos Tier 1 BF Id : 1
Server listening to : 0.0.0.0:10300

Zero ALL BF Statuses are LOCKED errors since. Confirmed in game: a battlefield objective captured and held through its tick, which was not previously possible.

Also verified that campaign initialisation now completes with no exception handling around it at all — this NRE was the only thing being thrown there. Anyone carrying a local try/catch around the LockBattleFrontsAllRegions / OpenActiveBattlefront / UpdateRegionCaptureStatus block to survive startup should be able to drop it after this.

Builds clean against master, zero errors or warnings.

🤖 Generated with Claude Code

BattlefieldObjective.RemoveGlow dereferences Region, which is => Zone?.Region and
is therefore null for objectives constructed by LoadObjectives that were never
added to a zone. Startup locking walks exactly those, so the NRE propagated out of
LockBattleFrontsAllRegions.

Core.Main catches around the whole campaign block so the server can still boot, so
the throw was not fatal - it just meant OpenActiveBattlefront never ran. Every
battlefront stayed locked, and at runtime GetActiveBattleFrontStatus called
.Single() on an empty set:

    WARN  Campaign.GetActiveBattleFrontStatus :: ALL BF Statuses are LOCKED
    ERROR EXCEPTION: <player> in Region 11 - StateMachineException

The objective's state machine has no exception listener, so objectives never
progressed past capture. The symptom appears hours after the one ERROR line at
startup that explains it, which is what made it hard to attribute.

Guarding the null lets locking complete, so OpenActiveBattlefront runs and the
campaign initialises. Verified in game: a battlefield objective captured and held
through its tick. Log now shows "Opening Active battlefronts" with no preceding
"RvR campaign initialisation failed".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant