Diff

util/dbuffer.lua @ 11028:d7a403060946

util.dbuffer: Fix traceback when :collapse() is called on empty buffer
author Matthew Wild <mwild1@gmail.com>
date Thu, 20 Aug 2020 15:22:19 +0100
parent 10980:eaee72c7afbd
child 11045:8c6bace13229
line wrap: on
line diff
--- a/util/dbuffer.lua	Sun Aug 16 20:30:02 2020 +0200
+++ b/util/dbuffer.lua	Thu Aug 20 15:22:19 2020 +0100
@@ -142,7 +142,7 @@
 
 	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