mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 15:58:17 +00:00
coverity/13969: handle u_save() failure
Looking at the implementation of u_save suggests that its failure is a normal and expected situation (e.g. if undo isn't allowed for some reason, it will fail). Also (most of) the other calls to u_save() in do_put() return early.
This commit is contained in:

committed by
Justin M. Keyes

parent
2aa308c685
commit
b44b533ada
@@ -2724,7 +2724,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
||||
// So the 'u' command restores cursor position after ".p, save the cursor
|
||||
// position now (though not saving any text).
|
||||
if (command_start_char == 'a') {
|
||||
u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1);
|
||||
if (u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1) == FAIL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2742,7 +2744,6 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
||||
// Autocommands may be executed when saving lines for undo, which may make
|
||||
// y_array invalid. Start undo now to avoid that.
|
||||
if (u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1) == FAIL) {
|
||||
ELOG("Failed to save undo information");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user