Skip to content

Commit 3aa8c2d

Browse files
authored
fix(install): fix NPE while installation (#64)
1 parent 7c53d6f commit 3aa8c2d

File tree

5 files changed

+568
-395
lines changed

5 files changed

+568
-395
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ jobs:
3636
token: ${{ secrets.GITHUB_TOKEN }}
3737
version: latest
3838
args: --config-path .stylua.toml ./lua
39-
- name: Add rxi/json.lua
39+
- name: Add json.lua
4040
if: ${{ github.ref != 'refs/heads/main' }}
4141
shell: bash
4242
run: |
4343
echo "pwd"
4444
echo $PWD
45-
git clone --depth 1 https://github.com/rxi/json.lua.git ~/.json.lua
46-
cp ~/.json.lua/json.lua ./lua/colorbox/rxi_json.lua
45+
git clone --depth=1 https://github.com/actboy168/json.lua.git ~/.json.lua
46+
cp ~/.json.lua/json.lua ./lua/colorbox/actboy168_json.lua
4747
- name: Auto Commit
4848
if: ${{ github.ref != 'refs/heads/main' }}
4949
uses: stefanzweifel/git-auto-commit-action@v4

lua/colorbox.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ local logger = require("colorbox.logger")
22
local LogLevels = require("colorbox.logger").LogLevels
33
local utils = require("colorbox.utils")
44
local json = require("colorbox.json")
5+
local uv = (vim.fn.has("nvim-0.10") > 0 and vim.uv ~= nil) and vim.uv
6+
or vim.loop
57

68
--- @alias colorbox.Options table<any, any>
79
--- @type colorbox.Options
@@ -137,7 +139,9 @@ local function _init()
137139
local ColorNamesList = require("colorbox.db").get_color_names_list()
138140
for _, color_name in pairs(ColorNamesList) do
139141
local spec = ColorNameToColorSpecsMap[color_name]
140-
if not _should_filter(color_name, spec) then
142+
local stat = uv.fs_stat(spec.full_pack_path)
143+
local obj_exist = stat ~= nil
144+
if not _should_filter(color_name, spec) and obj_exist then
141145
table.insert(FilteredColorNamesList, color_name)
142146
end
143147
end

0 commit comments

Comments
 (0)