Repository: neovim
Issue: Assertion `row >=0` failed for oneline error message 
Labels: ui,has:backtrace,bug-crash,messages

### Problem

Nvim crashes when changing `lines` on `VimEnter` and some error message has to be displayed. 
```cpp
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007f60947b4ebf in __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:78
#2  0x00007f6094760c82 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f60947494f0 in __GI_abort () at ./stdlib/abort.c:79
#4  0x00007f6094749418 in __assert_fail_base (fmt=0x7f60948cdca0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5629937ec59f "row >= 0",
    file=file@entry=0x562993812920 ".../src/nvim/message.c", line=line@entry=2406, function=function@entry=0x5629937c7890 <__PRETTY_FUNCTION__.0> "msg_scroll_flush") at ./assert/assert.c:94
#5  0x00007f6094759592 in __assert_fail (assertion=assertion@entry=0x5629937ec59f "row >= 0", file=file@entry=0x562993812920 ".../src/nvim/message.c", line=line@entry=2406,
    function=function@entry=0x5629937c7890 <__PRETTY_FUNCTION__.0> "msg_scroll_flush") at ./assert/assert.c:103
#6  0x000056299358c74b in msg_scroll_flush () at .../src/nvim/message.c:2406
#7  0x00005629936799b7 in ui_flush () at .../src/nvim/ui.c:542
#8  0x000056299358d4df in msg_check_for_delay (check_msg_scroll=false) at .../src/nvim/message.c:3725
#9  0x00005629934835e2 in screenclear () at .../src/nvim/drawscreen.c:222
#10 0x000056299348db0c in screen_resize (width=<optimized out>, height=<optimized out>) at .../src/nvim/drawscreen.c:338
#11 0x00005629935bb14a in did_set_lines_or_columns (args=<optimized out>) at .../src/nvim/option.c:2158
#12 0x00005629935bcfe9 in did_set_option (opt_idx=opt_idx@entry=kOptLines, varp=varp@entry=0x56299393e718 <p_lines>, old_value=..., new_value=..., opt_flags=opt_flags@entry=0, set_sid=set_sid@entry=0, direct=direct@entry=false,
    value_replaced=value_replaced@entry=true, errbuf=0x7ffc32184220 "\220&ܶ)V", errbuflen=80) at .../src/nvim/option.c:3478
#13 0x00005629935bdf43 in set_option (opt_idx=kOptLines, varp=varp@entry=0x56299393e718 <p_lines>, value=..., opt_flags=opt_flags@entry=0, set_sid=set_sid@entry=0, direct=direct@entry=false, value_replaced=value_replaced@entry=true,
    errbuf=0x7ffc32184220 "\220&ܶ)V", errbuflen=80) at .../src/nvim/option.c:3713
#14 0x00005629935bf694 in do_one_set_option (opt_flags=opt_flags@entry=0, argp=argp@entry=0x7ffc32184208, did_show=did_show@entry=0x7ffc32184217, errbuf=errbuf@entry=0x7ffc32184220 "\220&ܶ)V", errbuflen=errbuflen@entry=80,
    errmsg=errmsg@entry=0x7ffc32184218) at .../src/nvim/option.c:1339
#15 0x00005629935bfe23 in do_set (arg=<optimized out>, opt_flags=0) at .../src/nvim/option.c:1389
#16 0x00005629935c0059 in ex_set (eap=<optimized out>) at .../src/nvim/option.c:721
#17 0x00005629934e48a6 in execute_cmd0 (retv=retv@entry=0x7ffc32184334, eap=eap@entry=0x7ffc32184340, errormsg=errormsg@entry=0x7ffc32184338, preview=preview@entry=false) at .../src/nvim/ex_docmd.c:1714
#18 0x00005629934e5fe4 in do_one_cmd (cmdlinep=cmdlinep@entry=0x7ffc32184588, flags=flags@entry=7, cstack=cstack@entry=0x7ffc32184610, fgetline=fgetline@entry=0x56299345510b <getnextac>, cookie=cookie@entry=0x7ffc32184be0)
    at .../src/nvim/ex_docmd.c:2358
#19 0x00005629934e6b8f in do_cmdline (cmdline=<optimized out>, fgetline=0x56299345510b <getnextac>, cookie=0x7ffc32184be0, flags=7) at .../src/nvim/ex_docmd.c:667
#20 0x0000562993453d99 in apply_autocmds_group (event=EVENT_VIMENTER, fname=0x5629b6d6e270 "", fname_io=<optimized out>, force=<optimized out>, group=group@entry=-3, buf=0x5629b6d595b0, eap=0x0, data=0x0)
    at .../src/nvim/autocmd.c:1842
#21 0x000056299345444d in apply_autocmds (event=<optimized out>, fname=<optimized out>, fname_io=<optimized out>, force=<optimized out>, buf=<optimized out>) at .../src/nvim/autocmd.c:1499
#22 0x000056299355dfeb in main (argc=7, argv=<optimized out>) at .../src/nvim/main.c:605
```

Possible duplicate of https://github.com/neovim/neovim/issues/22919 but the message does not need any newline character. Please close this issue in such case. 

### Steps to reproduce

```sh
nvim  --clean --cmd 'au VimEnter * set lines=10' -c 'echoerr 1'
```

Cannot reproduce it for Vim (`vim -u NONE --cmd 'au VimEnter * set lines=10' -c 'echoerr 1'`).

### Expected behavior

No crash

### Nvim version (nvim -v)

v0.11.0-dev-1067+gb4599acbf

### Vim (not Nvim) behaves the same?

no, 9.1.777

### Operating system/version

Debian Sid

### Terminal name/version

alacritty 0.15.0-dev (6dbd785b)

### $TERM environment variable

alacritty

### Installation

from repo