From 1f9c446a98c9082ac1083532f8419966773a8f1e Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 16 May 2022 03:21:52 +0200 Subject: [PATCH] Assert that pixel data is encoded --- init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init.lua b/init.lua index 07e1ebde3..e8cc8942a 100644 --- a/init.lua +++ b/init.lua @@ -76,6 +76,7 @@ function image:encode_data(properties) local color_format = properties.color_format local compression = properties.compression + local data_length_before = #self.data if "Y8" == color_format and "RAW" == compression then if 8 == self.pixel_depth then self:encode_data_Y8_as_Y8_raw() @@ -99,6 +100,11 @@ function image:encode_data(properties) self:encode_data_R8G8B8A8_as_B8G8R8A8_raw() end end + local data_length_after = #self.data + assert( + data_length_after ~= data_length_before, + "No data encoded for color format: " .. color_format + ) end function image:encode_data_Y8_as_Y8_raw()