mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
floatwin: show error if window is closed immediately #11476
Autocmds may close window while it is being entered, then win_set_minimal_style(wp) operates on an invalid pointer. We could silently ignore this instead, but it is unlikely to be intentional, so it is more useful to show an error. fix #11383
This commit is contained in:
@@ -1096,6 +1096,10 @@ Window nvim_open_win(Buffer buffer, Boolean enter, Dictionary config,
|
||||
if (enter) {
|
||||
win_enter(wp, false);
|
||||
}
|
||||
if (!win_valid(wp)) {
|
||||
api_set_error(err, kErrorTypeException, "Window was closed immediately");
|
||||
return 0;
|
||||
}
|
||||
if (buffer > 0) {
|
||||
nvim_win_set_buf(wp->handle, buffer, err);
|
||||
}
|
||||
|
Reference in New Issue
Block a user