Tasproj loading - don't attempt to read from empty files if they exist but are empty
This commit is contained in:
parent
5a893c1a43
commit
2041b15260
|
@ -85,6 +85,8 @@ namespace BizHawk.Client.Common
|
||||||
public void Load(BinaryReader br)
|
public void Load(BinaryReader br)
|
||||||
{
|
{
|
||||||
LagLog.Clear();
|
LagLog.Clear();
|
||||||
|
if (br.BaseStream.Length > 0)
|
||||||
|
{
|
||||||
int length = br.ReadInt32();
|
int length = br.ReadInt32();
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
|
@ -93,3 +95,4 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -229,6 +229,8 @@ namespace BizHawk.Client.Common
|
||||||
public void Load(BinaryReader br)
|
public void Load(BinaryReader br)
|
||||||
{
|
{
|
||||||
States.Clear();
|
States.Clear();
|
||||||
|
if (br.BaseStream.Length > 0)
|
||||||
|
{
|
||||||
int nstates = br.ReadInt32();
|
int nstates = br.ReadInt32();
|
||||||
for (int i = 0; i < nstates; i++)
|
for (int i = 0; i < nstates; i++)
|
||||||
{
|
{
|
||||||
|
@ -239,6 +241,7 @@ namespace BizHawk.Client.Common
|
||||||
Used += len;
|
Used += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public KeyValuePair<int, byte[]> GetStateClosestToFrame(int frame)
|
public KeyValuePair<int, byte[]> GetStateClosestToFrame(int frame)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,8 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PopulateFromString(string settings)
|
public void PopulateFromString(string settings)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(settings))
|
||||||
{
|
{
|
||||||
var lines = settings.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
var lines = settings.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
SaveGreenzone = bool.Parse(lines[0]);
|
SaveGreenzone = bool.Parse(lines[0]);
|
||||||
|
@ -59,3 +61,4 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue