mirror of
https://github.com/neovim/neovim.git
synced 2026-07-14 05:10:36 +00:00
fix(ctx): coverity CHECKED_RETURN
CID 649145: Error handling issues CHECKED_RETURN
/src/nvim/api/window.c: 138 in nvim_win_set_cursor()
132 // Make sure we stick in this column.
133 w->w_set_curswant = true;
134
135 // make sure cursor is in visible range and
136 // cursorcolumn and cursorline are updated even if w != curwin
137 CtxSwitch switchwin;
>>> CID 649145: Error handling issues (CHECKED_RETURN)
>>> Calling "ctx_switch" without checking return value (as is done elsewhere 5 out of 6 times).
138 ctx_switch(&switchwin, w, NULL, NULL, kCtxNoEvents | kCtxNoDisplay);
139 update_topline(curwin);
140 validate_cursor(curwin);
141 ctx_restore(&switchwin);
142
143 redraw_later(w, UPD_VALID);
This commit is contained in:
@@ -135,9 +135,10 @@ void nvim_win_set_cursor(Window win, ArrayOf(Integer, 2) pos, Error *err)
|
||||
// make sure cursor is in visible range and
|
||||
// cursorcolumn and cursorline are updated even if w != curwin
|
||||
CtxSwitch switchwin;
|
||||
ctx_switch(&switchwin, w, NULL, NULL, kCtxNoEvents | kCtxNoDisplay);
|
||||
update_topline(curwin);
|
||||
validate_cursor(curwin);
|
||||
if (ctx_switch(&switchwin, w, NULL, NULL, kCtxNoEvents | kCtxNoDisplay)) {
|
||||
update_topline(curwin);
|
||||
validate_cursor(curwin);
|
||||
}
|
||||
ctx_restore(&switchwin);
|
||||
|
||||
redraw_later(w, UPD_VALID);
|
||||
|
||||
Reference in New Issue
Block a user