From 5515e9fea7ab35ec65b1d7a7556e547a171a48f9 Mon Sep 17 00:00:00 2001 From: adelikat Date: Mon, 13 Jul 2020 19:39:29 -0500 Subject: [PATCH] Tastudio - add some paranoia checks when drawing markers and branches. This happened one time while debugging and I couldn't reproduce, but it is possible the controls might need be told to redraw while still rebooting the core, in which case there is no TasMovie to read from yet, so check for null --- .../tools/TAStudio/BookmarksBranchesBox.cs | 12 ++++++++++++ .../tools/TAStudio/MarkerControl.cs | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index 75d52c192f..66fe24f38a 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -95,6 +95,12 @@ namespace BizHawk.Client.EmuHawk { text = ""; + // 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 == null) + { + return; + } + if (index >= Branches.Count) { return; @@ -111,6 +117,12 @@ namespace BizHawk.Client.EmuHawk private void 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 == null) + { + return; + } + var branch = Branches[index]; if (branch != null) { diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs index 6b0641cdae..2c97e5eb64 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs @@ -58,6 +58,12 @@ 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 == null) + { + return; + } + var prev = Markers.PreviousOrCurrent(Tastudio.Emulator.Frame); if (prev != null && index == Markers.IndexOf(prev)) @@ -88,6 +94,12 @@ namespace BizHawk.Client.EmuHawk { text = ""; + // 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 == null) + { + return; + } + if (column.Name == "FrameColumn") { text = Markers[index].Frame.ToString();