diff src/terminal.c @ 15217:49bc670c3ee9 v8.1.0618

patch 8.1.0618: term_getjob() does not return v:null as documented commit https://github.com/vim/vim/commit/528ccfbaa1cc805f430a750c551e5a9fd7eb54fe Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 21 20:55:22 2018 +0100 patch 8.1.0618: term_getjob() does not return v:null as documented Problem: term_getjob() does not return v:null as documented. Solution: Do return v:null. (Damien) Add a test.
author Bram Moolenaar <Bram@vim.org>
date Fri, 21 Dec 2018 21:00:06 +0100
parents de63593896b3
children 544490b69e1d
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -4794,11 +4794,14 @@ f_term_getjob(typval_T *argvars, typval_
 {
     buf_T	*buf = term_get_buf(argvars, "term_getjob()");
 
+    if (buf == NULL)
+    {
+	rettv->v_type = VAR_SPECIAL;
+	rettv->vval.v_number = VVAL_NULL;
+	return;
+    }
+
     rettv->v_type = VAR_JOB;
-    rettv->vval.v_job = NULL;
-    if (buf == NULL)
-	return;
-
     rettv->vval.v_job = buf->b_term->tl_job;
     if (rettv->vval.v_job != NULL)
 	++rettv->vval.v_job->jv_refcount;