Tasproj loading - don't attempt to read from empty files if they exist but are empty

This commit is contained in:
adelikat 2014-11-20 00:14:33 +00:00
parent 5a893c1a43
commit 2041b15260
3 changed files with 22 additions and 13 deletions

View File

@ -85,6 +85,8 @@ namespace BizHawk.Client.Common
public void Load(BinaryReader br)
{
LagLog.Clear();
if (br.BaseStream.Length > 0)
{
int length = br.ReadInt32();
for (int i = 0; i < length; i++)
{
@ -93,3 +95,4 @@ namespace BizHawk.Client.Common
}
}
}
}

View File

@ -229,6 +229,8 @@ namespace BizHawk.Client.Common
public void Load(BinaryReader br)
{
States.Clear();
if (br.BaseStream.Length > 0)
{
int nstates = br.ReadInt32();
for (int i = 0; i < nstates; i++)
{
@ -239,6 +241,7 @@ namespace BizHawk.Client.Common
Used += len;
}
}
}
public KeyValuePair<int, byte[]> GetStateClosestToFrame(int frame)
{

View File

@ -52,6 +52,8 @@ namespace BizHawk.Client.Common
}
public void PopulateFromString(string settings)
{
if (!string.IsNullOrWhiteSpace(settings))
{
var lines = settings.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
SaveGreenzone = bool.Parse(lines[0]);
@ -59,3 +61,4 @@ namespace BizHawk.Client.Common
}
}
}
}