Fix possible endless loop in replay recorder while opening save file.
This commit is contained in:
@@ -19,6 +19,9 @@ namespace OpenRA.Network
|
|||||||
{
|
{
|
||||||
sealed class ReplayRecorder
|
sealed class ReplayRecorder
|
||||||
{
|
{
|
||||||
|
// Arbitrary value.
|
||||||
|
const int CreateReplayFileMaxRetryCount = 128;
|
||||||
|
|
||||||
public ReplayMetadata Metadata;
|
public ReplayMetadata Metadata;
|
||||||
BinaryWriter writer;
|
BinaryWriter writer;
|
||||||
Func<string> chooseFilename;
|
Func<string> chooseFilename;
|
||||||
@@ -59,7 +62,12 @@ namespace OpenRA.Network
|
|||||||
{
|
{
|
||||||
file = File.Create(fullFilename);
|
file = File.Create(fullFilename);
|
||||||
}
|
}
|
||||||
catch (IOException) { }
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
if (id > CreateReplayFileMaxRetryCount)
|
||||||
|
throw new ArgumentException(
|
||||||
|
"Error creating replay file \"{0}.orarep\"".F(filename), ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file.WriteArray(initialContent);
|
file.WriteArray(initialContent);
|
||||||
|
|||||||
Reference in New Issue
Block a user