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
commitf3a7b63d84ca567c716a4426ec77c620a0aed98c (patch)
tree42927a0d18d3c19b3f5d4f14fe7ab38723815eab /util/statistics.lua
parentb21f268615f10ee6360dfb1f01af55fc35a02970 (diff)
downloadprosody-f3a7b63d84ca567c716a4426ec77c620a0aed98c.tar.gz
prosody-f3a7b63d84ca567c716a4426ec77c620a0aed98c.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