nvim-tree / nvim-web-devicons

lua `fork` of vim-web-devicons for neovim
MIT License
1.98k stars 183 forks source link

get_icon fail when name is nil #220

Closed EpiCanard closed 1 year ago

EpiCanard commented 1 year ago

Hello,

The feature https://github.com/nvim-tree/nvim-web-devicons/pull/217 seems to break something with get_icon.

Previously if you had the name equal to nil it falled back on extension or default_icon.

Now if name is nil it show an error because it can't call :lower on a nil value.

E5108: Error executing lua ...re/nvim/lazy/nvim-web-devicons/lua/nvim-web-devicons.lua:1911: attempt to index local 'name' (a nil value)                                         
stack traceback:                                                                                                                                                                 
        ...re/nvim/lazy/nvim-web-devicons/lua/nvim-web-devicons.lua:1911: in function 'get_icon'

Best Regards

alex-courtis commented 1 year ago

Thanks for raising this.

I'd be most grateful if you tested a fix:

cd /path/to/nvim-web-devicons
git pull
git checkout 220-get_icon-allow-nil-name
EpiCanard commented 1 year ago

It works perfectly !

Thank you !