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

This commit is contained in:
adelikat 2020-07-13 19:39:29 -05:00
parent 946ff45608
commit 5515e9fea7
2 changed files with 24 additions and 0 deletions

View File

@ -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)
{

View File

@ -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();