ops.c: do_join expects count of 2 or greater #6855

test_normal.vim fails if we assert >= 2, so we only check >= 1. That at
least avoids invalid pointers.

    TEST_FILE=test_normal.res make oldtest
This commit is contained in:
Zach Gleason 2019-03-01 22:52:03 -05:00 committed by Justin M. Keyes
parent 8ba484ab69
commit 0aba4d825a

View File

@ -3608,6 +3608,7 @@ int do_join(size_t count,
int remove_comments = (use_formatoptions == TRUE) int remove_comments = (use_formatoptions == TRUE)
&& has_format_option(FO_REMOVE_COMS); && has_format_option(FO_REMOVE_COMS);
bool prev_was_comment = false; bool prev_was_comment = false;
assert(count >= 1);
if (save_undo && u_save(curwin->w_cursor.lnum - 1, if (save_undo && u_save(curwin->w_cursor.lnum - 1,
curwin->w_cursor.lnum + (linenr_T)count) == FAIL) { curwin->w_cursor.lnum + (linenr_T)count) == FAIL) {