Skip to content

Commit

Permalink
fix: null reference
Browse files Browse the repository at this point in the history
  • Loading branch information
oscar-wos committed Oct 12, 2024
1 parent 7280c66 commit d10786d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion src/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ private HookResult OnRoundStart(EventRoundStart @event, GameEventInfo info)
_bombPlanted = false;

_gameRules ??= Utilities.FindAllEntitiesByDesignerName<CCSGameRulesProxy>("cs_gamerules").First().GameRules!;
_warmup = _gameRules?.WarmupPeriod;

foreach (var zone in _zones)
{
Expand Down
1 change: 0 additions & 1 deletion src/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public partial class AntiRush
private readonly List<Zone> _zones = [];
private float _roundStart;
private bool _bombPlanted;
private bool _warmup;
private float[] _countdown = [];
private CCSGameRules? _gameRules;
}
2 changes: 1 addition & 1 deletion src/Listeners.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public partial class AntiRush
{
private void OnTick()
{
if (!Config.Warmup && _warmup)
if (!Config.Warmup && _gameRules?.WarmupPeriod)

Check failure on line 10 in src/Listeners.cs

View workflow job for this annotation

GitHub Actions / build

Operator '&&' cannot be applied to operands of type 'bool' and 'bool?'

Check failure on line 10 in src/Listeners.cs

View workflow job for this annotation

GitHub Actions / build

Operator '&&' cannot be applied to operands of type 'bool' and 'bool?'
return;

if (Config.NoRushTime != 0 && !_bombPlanted)
Expand Down

0 comments on commit d10786d

Please sign in to comment.