RMichelsen / Nvy

Nvy - A Neovim client in C++
MIT License
334 stars 28 forks source link

Check cursor mode before drawing #50

Closed statiolake closed 2 years ago

statiolake commented 2 years ago

With newer version of Neovim, Nvy sometimes crashes on startup. More accurately, Nvy always crashes with one of my vimrc, but never crashes with my another vimrc. There seems to be something related to this issue in my configuration. However, the direct cause of this crash is that in that case DrawCursor() accesses to the renderer->cursor.mode_info before it is set, resulting in NULL dereference. Checking that variable is non-NULL fixed the issue.

I'm still not sure the exact factor causing this, maybe it is a bug on Neovim, but I think this is a harmless change, so I opened this PR.

RMichelsen commented 2 years ago

You're right, either I have made a faulty assumption that we should always get an "UpdateCursor" call before we draw it or something fishy is up with that specific vimrc, in any case the extra check is good to have.