From f3a7b63d84ca567c716a4426ec77c620a0aed98c Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 30 Jan 2015 14:21:51 +0000 Subject: util.statistics: Return 0 as percentile if data out of range --- util/statistics.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/statistics.lua') diff --git a/util/statistics.lua b/util/statistics.lua index 08c765ae..a05a1f91 100644 --- a/util/statistics.lua +++ b/util/statistics.lua @@ -8,7 +8,7 @@ local function percentile(arr, length, pc) local n = pc/100 * (length + 1); local k, d = m_floor(n), n%1; if k == 0 then - return arr[1]; + return arr[1] or 0; elseif k >= length then return arr[length]; end -- cgit v1.2.3