aboutsummaryrefslogtreecommitdiffstats
path: root/util/statistics.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-01-30 14:21:51 +0000
committerMatthew Wild <mwild1@gmail.com>2015-01-30 14:21:51 +0000
commitedd7f28ffeb00f26708185af9da72125f591cc80 (patch)
tree42927a0d18d3c19b3f5d4f14fe7ab38723815eab /util/statistics.lua
parent26854f710c5d0c038738ddfda11406ce13a4536a (diff)
downloadprosody-edd7f28ffeb00f26708185af9da72125f591cc80.tar.gz
prosody-edd7f28ffeb00f26708185af9da72125f591cc80.zip
util.statistics: Return 0 as percentile if data out of range
Diffstat (limited to 'util/statistics.lua')
-rw-r--r--util/statistics.lua2
1 files changed, 1 insertions, 1 deletions
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