From 6868dcd7c4517efa3718784e2b471e6a108cb941 Mon Sep 17 00:00:00 2001 From: "junlong.lin" Date: Thu, 22 Apr 2021 10:33:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E8=B6=8A?= =?UTF-8?q?=E7=95=8C=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Window/ProfilerWin/TreeView/LuaProfilerTreeView.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/LuaProfiler/example/Assets/LuaProfiler/Editor/Window/ProfilerWin/TreeView/LuaProfilerTreeView.cs b/LuaProfiler/example/Assets/LuaProfiler/Editor/Window/ProfilerWin/TreeView/LuaProfilerTreeView.cs index efd3a082..39a178a6 100644 --- a/LuaProfiler/example/Assets/LuaProfiler/Editor/Window/ProfilerWin/TreeView/LuaProfilerTreeView.cs +++ b/LuaProfiler/example/Assets/LuaProfiler/Editor/Window/ProfilerWin/TreeView/LuaProfilerTreeView.cs @@ -911,6 +911,7 @@ public void LoadRootSample(Sample sample) public int GetNextFrame(int start, bool isChange) { + start = Math.Max(1, Math.Min(start, history.Count - 1)); int ret = start; int frameCount = history[start].frameCount; for (int i = start + 1, imax = history.Count; i < imax; i++) @@ -930,6 +931,9 @@ public int GetNextFrame(int start, bool isChange) public int GetPreFrame(int start, bool isChange) { + if (history.Count <= 0) return 0; + + start = Math.Max(1, Math.Min(start, history.Count - 1)); int ret = start; int frameCount = history[start].frameCount; for (int i = start - 1; i >= 0; i--) @@ -950,7 +954,10 @@ public int GetPreFrame(int start, bool isChange) public int GetNextProgramFrame(int start) { + if (history.Count <= 0) return 0; + start = Math.Max(1, Math.Min(start, history.Count - 1)); int ret = start + 1; + if (ret >= history.Count) return history.Count - 1; var setting = LuaDeepProfilerSetting.Instance; for (int i = start + 1, imax = history.Count; i < imax; i++)