Skip to content

[Game Server] Null reference risks in MatchManager, ReadySystem, MatchUtility #399

@Flegma

Description

@Flegma

Summary

Several locations access objects without null checks, risking NullReferenceException or KeyNotFoundException.

Findings

  • MatchManager.cs — _matchData checked for null then accessed in lambda. Race condition if it becomes null between check and access.
  • ReadySystem.cs — _readyPlayers[player.UserId.Value] without checking key exists. KeyNotFoundException on reconnect.
  • MatchUtility.cs — tag == null check on non-nullable string. Should use string.IsNullOrEmpty().

Impact

Server crashes when players reconnect or during race conditions.

Suggested Fix

Use TryGetValue for dictionary access. Store _matchData in local variable before lambda. Use string.IsNullOrEmpty().

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highStability & reliabilityaudit-2026-03From March 2026 codebase auditnull-safetyNull/undefined safety issueservice:game-server5stackgg/game-server service

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions