Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty uri's crashes plugin; nil string in _is_root_path #47

Open
TamaMcGlinn opened this issue Sep 16, 2024 · 0 comments
Open

empty uri's crashes plugin; nil string in _is_root_path #47

TamaMcGlinn opened this issue Sep 16, 2024 · 0 comments

Comments

@TamaMcGlinn
Copy link

When opening a markdown file with invalid image uri's, like this:

![something]()

I'm getting this error message:

Error detected while processing function dirvish#open[14]..<SNR>356_open_selected[22]..BufWinEnter Autocommands for "*":                                                                                       
Error executing lua callback: ...tama/.vim/plugged/hologram.nvim/lua/hologram/init.lua:120: bad argument #1 to 'sub' (string expected, got nil)                                                             
stack traceback:                                                                                                                                                                                               
        [C]: in function 'sub'                                                                                                                                                                                 
        ...tama/.vim/plugged/hologram.nvim/lua/hologram/init.lua:120: in function '_is_root_path'                                                                                                           
        ...tama/.vim/plugged/hologram.nvim/lua/hologram/init.lua:109: in function '_to_absolute_path'                                                                                                       
        ...tama/.vim/plugged/hologram.nvim/lua/hologram/init.lua:100: in function 'find_source'                                                                                                             
        ...tama/.vim/plugged/hologram.nvim/lua/hologram/init.lua:74: in function 'buf_generate_images'

Instead, the plugin should ignore them. The fix is to add if not source then return nil end inside hologram.find_source in lua/hologram/init.lua line 99.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant