diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 9a0c424011..451debf940 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -14799,7 +14799,8 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm result = FAIL; } - if (t->state->out->out1->c == NFA_END_COMPOSING) { + if (t->state->out->out1 != NULL + && t->state->out->out1->c == NFA_END_COMPOSING) { end = t->state->out->out1; ADD_STATE_IF_MATCH(end); } diff --git a/test/old/testdir/crash/nullptr_regexp_nfa b/test/old/testdir/crash/nullptr_regexp_nfa new file mode 100644 index 0000000000..6b2edc62a3 Binary files /dev/null and b/test/old/testdir/crash/nullptr_regexp_nfa differ diff --git a/test/old/testdir/test_crash.vim b/test/old/testdir/test_crash.vim index 4f13949fc6..ba11a94e06 100644 --- a/test/old/testdir/test_crash.vim +++ b/test/old/testdir/test_crash.vim @@ -232,6 +232,11 @@ func Test_crash1_3() call term_sendkeys(buf, args) call TermWait(buf, 50) + let file = 'crash/nullptr_regexp_nfa' + let cmn_args = "%s -u NONE -i NONE -n -X -m -n -e -s -S %s -c ':qa!'" + let args = printf(cmn_args, vim, file) + call term_sendkeys(buf, args) + call TermWait(buf, 50) " clean up exe buf .. "bw!"