Fix invalid array index issue (#484)

L 11/05/2017 - 21:07:50: [SM] Exception reported: Invalid index 0 (count: 0)
L 11/05/2017 - 21:07:50: [SM] Blaming: shavit-wr.smx
L 11/05/2017 - 21:07:50: [SM] Call stack trace:
L 11/05/2017 - 21:07:50: [SM]   [0] ArrayList.Get
L 11/05/2017 - 21:07:50: [SM]   [1] Line 2202, E:\git\bhoptimer\addons\sourcemod\scripting\shavit-wr.sp::GetRankForTime
L 11/05/2017 - 21:07:50: [SM]   [2] Line 2038, E:\git\bhoptimer\addons\sourcemod\scripting\shavit-wr.sp::Shavit_OnFinish
L 11/05/2017 - 21:07:50: [SM]   [4] Call_Finish
L 11/05/2017 - 21:07:50: [SM]   [5] Line 1016, E:\git\bhoptimer\addons\sourcemod\scripting\shavit-core.sp::Native_FinishMap
L 11/05/2017 - 21:07:50: [SM]   [7] Shavit_FinishMap
L 11/05/2017 - 21:07:50: [SM]   [8] Line 2321, E:\git\bhoptimer\addons\sourcemod\scripting\shavit-zones.sp::StartTouchPost
This commit is contained in:
shavit 2017-11-08 01:57:45 +02:00
parent bb05771440
commit ed11f900e8

View File

@ -2197,11 +2197,14 @@ int GetRankForTime(int style, float time, int track)
return 1;
}
for(int i = 0; i < gI_RecordAmount[style][track]; i++)
if(gA_LeaderBoard[style][track] != null && gA_LeaderBoard[style][track].Length > 0)
{
if(time < gA_LeaderBoard[style][track].Get(i))
for(int i = 0; i < gI_RecordAmount[style][track]; i++)
{
return ++i;
if(time < gA_LeaderBoard[style][track].Get(i))
{
return ++i;
}
}
}