Fix crash if shader debug comes back with empty trace array

* The current step wasn't being clamped correctly, so it would be set
  to -1 then used to index.
This commit is contained in:
baldurk
2015-03-12 00:43:13 +00:00
parent c30fd3e1e1
commit 7e1e87af1f
+3 -3
View File
@@ -73,9 +73,9 @@ namespace renderdocui.Windows
}
set
{
if (m_Trace != null && m_Trace.states != null)
if (m_Trace != null && m_Trace.states != null && m_Trace.states.Length > 0)
{
CurrentStep_ = Math.Min(m_Trace.states.Length - 1, Math.Max(0, value));
CurrentStep_ = Helpers.Clamp(value, 0, m_Trace.states.Length - 1);
}
else
{
@@ -765,7 +765,7 @@ namespace renderdocui.Windows
public void UpdateDebugging()
{
if (m_Trace == null || m_Trace.states.Length == 0)
if (m_Trace == null || m_Trace.states == null || m_Trace.states.Length == 0)
{
//curInstruction.Text = "0";