From 392f9b7f2d99178a44e52928f9acaaaf0fbad9be Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 21 Apr 2015 20:45:13 +0200 Subject: [PATCH] Clamp texture view slice to number of slices (sanity checking) * This should in theory be impossible as you can't create a view that points to after the number of slices, and we always make a list of all slices, but there was a crash report here so for now we'll just clamp so that it doesn't crash completely. --- renderdocui/Windows/TextureViewer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/renderdocui/Windows/TextureViewer.cs b/renderdocui/Windows/TextureViewer.cs index 8a3563be5..603bfdae6 100644 --- a/renderdocui/Windows/TextureViewer.cs +++ b/renderdocui/Windows/TextureViewer.cs @@ -1335,7 +1335,8 @@ namespace renderdocui.Windows } } - sliceFace.SelectedIndex = (int)m_Following.GetFirstArraySlice(m_Core); + int firstArraySlice = (int)m_Following.GetFirstArraySlice(m_Core); + sliceFace.SelectedIndex = Helpers.Clamp(firstArraySlice, 0, (int)numSlices - 1); } // mip and slice were reset to 0 above, we must restore any per-tex settings to apply