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