From 45003ea584d9e1457539b02874a5a11c662956fe Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 17 Jan 2020 09:00:56 -0600 Subject: [PATCH] revert "Use Ranges" on TasMovie since it causes exceptions when attempting to create the first branch of a tasproj --- BizHawk.Client.Common/movie/tasproj/TasMovie.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 4cf29f1b40..5182ca6f2b 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.IO; using System.Linq; -using BizHawk.Common; using BizHawk.Emulation.Common; using BizHawk.Emulation.Common.IEmulatorExtensions; @@ -347,7 +346,7 @@ namespace BizHawk.Client.Common var stateFrameValue = stateFrame ?? 0; - if (stateFrameValue.StrictlyBoundedBy(0.RangeTo(Log.Count))) + if (stateFrameValue > 0 && stateFrameValue < Log.Count) { if (!Global.Config.VBAStyleMovieLoadState) { @@ -380,7 +379,15 @@ namespace BizHawk.Client.Common #region Branches - public TasBranch GetBranch(int index) => 0.RangeToExclusive(Branches.Count).Contains(index) ? Branches[index] : null; + public TasBranch GetBranch(int index) + { + if (index >= Branches.Count || index < 0) + { + return null; + } + + return Branches[index]; + } public TasBranch GetBranch(Guid id) {