diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs index fa0a5aaf2d..a5ab900da9 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs @@ -51,37 +51,31 @@ namespace BizHawk.Client.EmuHawk private void MarkerView_QueryItemBkColor(int index, RollColumn column, ref Color color) { // This could happen if the control is told to redraw while Tastudio is rebooting, as we would not have a TasMovie just yet - if (Tastudio.CurrentTasMovie is null) - { - return; - } + if (Tastudio.CurrentTasMovie is null) return; + if (index >= Markers.Count) return; // this should never happen + + var marker = Markers[index]; var prev = Markers.PreviousOrCurrent(Tastudio.Emulator.Frame); - if (prev != null && index == Markers.IndexOf(prev)) + if (ReferenceEquals(marker, prev)) { // feos: taseditor doesn't have it, so we're free to set arbitrary color scheme. and I prefer consistency color = Tastudio.Palette.CurrentFrame_InputLog; } - else if (index < Markers.Count) + else if (Tastudio.CurrentTasMovie.LagLog[marker.Frame + 1] is bool lagged) { - var marker = Markers[index]; - bool? lagged = Tastudio.CurrentTasMovie.LagLog[marker.Frame + 1]; - - if (lagged.HasValue) + if (lagged) { - if (lagged.Value) - { - color = column.Name == "FrameColumn" - ? Tastudio.Palette.LagZone_FrameCol - : Tastudio.Palette.LagZone_InputLog; - } - else - { - color = column.Name == "LabelColumn" - ? Tastudio.Palette.GreenZone_FrameCol - : Tastudio.Palette.GreenZone_InputLog; - } + color = column.Name == "FrameColumn" + ? Tastudio.Palette.LagZone_FrameCol + : Tastudio.Palette.LagZone_InputLog; + } + else + { + color = column.Name == "LabelColumn" + ? Tastudio.Palette.GreenZone_FrameCol + : Tastudio.Palette.GreenZone_InputLog; } } }