1
0
forked from aniani/vim

patch 9.1.0481: Vim9: term_getjob() throws an exception on error

Problem:  Vim9: term_getjob() throws an exception on error
Solution: Return null_job instead, when there is no job
          (Ernie Rael)

closes: #14984

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ernie Rael
2024-06-13 17:24:54 +02:00
committed by Christian Brabandt
parent 1c29602662
commit a78eb25db3
4 changed files with 16 additions and 4 deletions

View File

@@ -6171,8 +6171,16 @@ f_term_getjob(typval_T *argvars, typval_T *rettv)
buf = term_get_buf(argvars, "term_getjob()");
if (buf == NULL)
{
rettv->v_type = VAR_SPECIAL;
rettv->vval.v_number = VVAL_NULL;
if (in_vim9script())
{
rettv->v_type = VAR_JOB;
rettv->vval.v_job = NULL;
}
else
{
rettv->v_type = VAR_SPECIAL;
rettv->vval.v_number = VVAL_NULL;
}
return;
}