panic and die if a problem like the one fixed by r3168 were to happen again, since we never really fixed anything

This commit is contained in:
goyuken 2013-08-11 19:26:19 +00:00
parent b0880eb4c0
commit 370b17b98d
1 changed files with 9 additions and 5 deletions

View File

@ -655,7 +655,7 @@ namespace BizHawk.MultiClient
public void LoadLogFromSavestateText(string path) public void LoadLogFromSavestateText(string path)
{ {
var reader = new StreamReader(path); var reader = new StreamReader(path);
int stateFrame = 0; int? stateFrame = null;
//We are in record mode so replace the movie log with the one from the savestate //We are in record mode so replace the movie log with the one from the savestate
if (!Global.MovieSession.MultiTrack.IsActive) if (!Global.MovieSession.MultiTrack.IsActive)
{ {
@ -731,15 +731,19 @@ namespace BizHawk.MultiClient
} }
} }
} }
if (stateFrame > 0 && stateFrame < Log.Length) if (stateFrame == null)
throw new Exception("Couldn't find stateFrame");
int stateFramei = (int)stateFrame;
if (stateFramei > 0 && stateFramei < Log.Length)
{ {
if (!Global.Config.VBAStyleMovieLoadState) if (!Global.Config.VBAStyleMovieLoadState)
{ {
Log.TruncateStates(stateFrame); Log.TruncateStates(stateFramei);
Log.TruncateMovie(stateFrame); Log.TruncateMovie(stateFramei);
} }
} }
else if (stateFrame > Log.Length) //Post movie savestate else if (stateFramei > Log.Length) //Post movie savestate
{ {
if (!Global.Config.VBAStyleMovieLoadState) if (!Global.Config.VBAStyleMovieLoadState)
{ {