summaryrefslogtreecommitdiffstats
path: root/src/terminal.c
diff options
context:
space:
mode:
authorErnie Rael <errael@raelity.com>2024-06-13 17:24:54 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-13 17:24:54 +0200
commita78eb25db3089b864dab8a9cc6c9e5270bf09644 (patch)
treec0c21d7aaad485d229e21a6756317989a0cd04ff /src/terminal.c
parent1c296026627d7ac8195e803b4c2393c21ae659b4 (diff)
patch 9.1.0481: Vim9: term_getjob() throws an exception on errorv9.1.0481
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>
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 07b69c6a7c..648fc78728 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -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;
}