diff options
author | Matthew Wild <mwild1@gmail.com> | 2015-01-30 14:21:51 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2015-01-30 14:21:51 +0000 |
commit | edd7f28ffeb00f26708185af9da72125f591cc80 (patch) | |
tree | 42927a0d18d3c19b3f5d4f14fe7ab38723815eab | |
parent | 26854f710c5d0c038738ddfda11406ce13a4536a (diff) | |
download | prosody-edd7f28ffeb00f26708185af9da72125f591cc80.tar.gz prosody-edd7f28ffeb00f26708185af9da72125f591cc80.zip |
util.statistics: Return 0 as percentile if data out of range
-rw-r--r-- | util/statistics.lua | 2 |
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 |