From 9115d2a366b8c588a22041c3e35c97b8d8a37af2 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 20 Aug 2020 15:22:19 +0100 Subject: util.dbuffer: Fix traceback when :collapse() is called on empty buffer --- util/dbuffer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') 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 -- cgit v1.2.3