Skip to content

Commit

Permalink
修复一些越界报错
Browse files Browse the repository at this point in the history
  • Loading branch information
junlong.lin committed Apr 22, 2021
1 parent 399c474 commit 6868dcd
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand All @@ -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--)
Expand All @@ -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++)
Expand Down

0 comments on commit 6868dcd

Please sign in to comment.