aboutsummaryrefslogtreecommitdiffstats
path: root/util/dbuffer.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-08-20 15:22:19 +0100
committerMatthew Wild <mwild1@gmail.com>2020-08-20 15:22:19 +0100
commit9115d2a366b8c588a22041c3e35c97b8d8a37af2 (patch)
tree853e0fbe967c83dc9cd8c2f95403d9c0af8d3129 /util/dbuffer.lua
parent8de93db692033a56ab3a516c9aadf6b27060e2a7 (diff)
downloadprosody-9115d2a366b8c588a22041c3e35c97b8d8a37af2.tar.gz
prosody-9115d2a366b8c588a22041c3e35c97b8d8a37af2.zip
util.dbuffer: Fix traceback when :collapse() is called on empty buffer
Diffstat (limited to 'util/dbuffer.lua')
-rw-r--r--util/dbuffer.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/dbuffer.lua b/util/dbuffer.lua
index 63dca750..9ec40eb9 100644
--- a/util/dbuffer.lua
+++ b/util/dbuffer.lua
@@ -142,7 +142,7 @@ function dbuffer_methods:collapse(bytes)
local front_chunk = self.items:peek();
- if #front_chunk - self.front_consumed >= bytes then
+ if not front_chunk or #front_chunk - self.front_consumed >= bytes then
return;
end