aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-02-10 14:01:54 -0400
committerjgmdev <jgmdev@gmail.com>2022-02-10 14:01:54 -0400
commit0b8440ae0d9cf0697f8bece9fbf49219e77747ee (patch)
tree1df2508dbf9509d40c8cd081d5cba5a50e9f974e
parent4435878b0e9afbe764de00f7c5b74898ae1274cb (diff)
downloadlite-xl-plugins-0b8440ae0d9cf0697f8bece9fbf49219e77747ee.tar.gz
lite-xl-plugins-0b8440ae0d9cf0697f8bece9fbf49219e77747ee.zip
colorpreview: added alpha value tonumber conversion check.
-rw-r--r--plugins/colorpreview.lua4
1 files changed, 2 insertions, 2 deletions
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