Catch replay start and end errors on round restarts (#20565)

This commit is contained in:
DrSmugleaf
2023-09-28 15:48:29 -07:00
committed by GitHub
parent bcad37f351
commit 14cfe44ece

View File

@@ -22,6 +22,8 @@ public sealed partial class GameTicker
/// A round has started: start recording replays if auto record is enabled. /// A round has started: start recording replays if auto record is enabled.
/// </summary> /// </summary>
private void ReplayStartRound() private void ReplayStartRound()
{
try
{ {
if (!_cfg.GetCVar(CCVars.ReplayAutoRecord)) if (!_cfg.GetCVar(CCVars.ReplayAutoRecord))
return; return;
@@ -57,17 +59,29 @@ public sealed partial class GameTicker
_sawmillReplays.Error("Can't start automatic replay recording!"); _sawmillReplays.Error("Can't start automatic replay recording!");
} }
} }
catch (Exception e)
{
Log.Error($"Error while starting an automatic replay recording:\n{e}");
}
}
/// <summary> /// <summary>
/// A round has ended: stop recording replays and make sure they're moved to the correct spot. /// A round has ended: stop recording replays and make sure they're moved to the correct spot.
/// </summary> /// </summary>
private void ReplayEndRound() private void ReplayEndRound()
{
try
{ {
if (_replays.ActiveRecordingState is ReplayRecordState) if (_replays.ActiveRecordingState is ReplayRecordState)
{ {
_replays.StopRecording(); _replays.StopRecording();
} }
} }
catch (Exception e)
{
Log.Error($"Error while stopping replay recording:\n{e}");
}
}
private void ReplaysOnRecordingFinished(ReplayRecordingFinished data) private void ReplaysOnRecordingFinished(ReplayRecordingFinished data)
{ {