Hi,

The term_getjob() function is documented to return v:null when something
wrong happen but Vim always return a job.


```
diff --git a/src/terminal.c b/src/terminal.c
index 5a0165814fac..1a62d06c63c1 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -4794,14 +4794,15 @@ f_term_getjob(typval_T *argvars, typval_
{
    buf_T       *buf = term_get_buf(argvars, "term_getjob()");

-    rettv->v_type = VAR_JOB;
-    rettv->vval.v_job = NULL;
-    if (buf == NULL)
-       return;
+    rettv->v_type = VAR_SPECIAL;
+    rettv->vval.v_number = VVAL_NULL;

-    rettv->vval.v_job = buf->b_term->tl_job;
-    if (rettv->vval.v_job != NULL)
+    if (buf != NULL && buf->b_term->tl_job != NULL)
+    {
+       rettv->v_type = VAR_JOB;
+       rettv->vval.v_job = buf->b_term->tl_job;
        ++rettv->vval.v_job->jv_refcount;
+    }
}

    static int
```

I didn't add test because I don't know what is expected but it can easily
reproduce on Linux:

```
 let term = term_start('false', {'term_finish': 'close'})
 if term != 0
   call WaitForAssert({-> assert_true(term_getjob(term) is v:null) })
 endif
```

Regards.
Damien

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui