From 0b8440ae0d9cf0697f8bece9fbf49219e77747ee Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 10 Feb 2022 14:01:54 -0400 Subject: colorpreview: added alpha value tonumber conversion check. --- plugins/colorpreview.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/colorpreview.lua') diff --git a/plugins/colorpreview.lua b/plugins/colorpreview.lua index 0464f35..c552f07 100644 --- a/plugins/colorpreview.lua +++ b/plugins/colorpreview.lua @@ -19,8 +19,8 @@ local function draw_color_previews(self, idx, x, y, ptn, base, nibbles) local str = text:sub(s, e) local r, g, b, a = str:match(ptn) r, g, b = tonumber(r, base), tonumber(g, base), tonumber(b, base) - if (a ~= nil) and (a ~= "") then - a = tonumber(a, base) + a = tonumber(a or "", base) + if a ~= nil then if base ~= 16 then a = a * 0xff end -- cgit v1.2.3