From 032df932199d21d37a85938219ab654b383755d8 Mon Sep 17 00:00:00 2001 From: Ethan Moffat Date: Fri, 20 May 2022 12:17:46 -0700 Subject: [PATCH] Swallow intermittent bugs due to race conditions from updating game components collection --- EndlessClient/GameExecution/EndlessGame.cs | 8 +++++++- EndlessClient/Rendering/Character/CharacterRenderer.cs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/EndlessClient/GameExecution/EndlessGame.cs b/EndlessClient/GameExecution/EndlessGame.cs index b7cc71603..c0d539c56 100644 --- a/EndlessClient/GameExecution/EndlessGame.cs +++ b/EndlessClient/GameExecution/EndlessGame.cs @@ -172,7 +172,13 @@ protected override void Update(GameTime gameTime) _previousKeyState = currentKeyState; - base.Update(gameTime); + try + { + base.Update(gameTime); + } + catch (ArgumentOutOfRangeException) + { + } } #endif diff --git a/EndlessClient/Rendering/Character/CharacterRenderer.cs b/EndlessClient/Rendering/Character/CharacterRenderer.cs index 9188fa1f0..a400e7948 100644 --- a/EndlessClient/Rendering/Character/CharacterRenderer.cs +++ b/EndlessClient/Rendering/Character/CharacterRenderer.cs @@ -257,7 +257,7 @@ public void DrawToSpriteBatch(SpriteBatch spriteBatch) _effectRenderer.DrawInFrontOfTarget(spriteBatch); if (_gameStateProvider.CurrentState == GameStates.PlayingTheGame) - _healthBarRenderer.DrawToSpriteBatch(spriteBatch); + _healthBarRenderer?.DrawToSpriteBatch(spriteBatch); } #endregion