]> granicus.if.org Git - vim/commitdiff
patch 7.4.1503 v7.4.1503
authorBram Moolenaar <Bram@vim.org>
Sun, 6 Mar 2016 20:34:03 +0000 (21:34 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 6 Mar 2016 20:34:03 +0000 (21:34 +0100)
Problem:    Crash when using ch_getjob(). (Damien)
Solution:   Check for a NULL job.

src/eval.c
src/testdir/test_channel.vim
src/version.c

index 23154061c4f7ec48b28d7334a55d6af6c8539cc7..510dd128da7e5b0d7c5b6e2f0ec1d06d3da1e67e 100644 (file)
@@ -15249,6 +15249,7 @@ f_job_start(typval_T *argvars UNUSED, typval_T *rettv)
 #endif
 
 #ifdef FEAT_CHANNEL
+    /* If the channel is reading from a buffer, write lines now. */
     channel_write_in(job->jv_channel);
 #endif
 
@@ -22601,7 +22602,11 @@ get_tv_string_buf_chk(typval_T *varp, char_u *buf)
 #ifdef FEAT_JOB
            {
                job_T *job = varp->vval.v_job;
-               char  *status = job->jv_status == JOB_FAILED ? "fail"
+               char  *status;
+
+               if (job == NULL)
+                   return (char_u *)"no process";
+               status = job->jv_status == JOB_FAILED ? "fail"
                                : job->jv_status == JOB_ENDED ? "dead"
                                : "run";
 # ifdef UNIX
index 31a4ff6eb29730c496a0f0fa4407e8cbf71ffe51..5133a249654b4e98cc7bbeb468abe6c23e62b694 100644 (file)
@@ -108,6 +108,10 @@ func s:communicate(port)
     call assert_false(1, "Can't open channel")
     return
   endif
+  if has('job')
+    " check that no job is handled correctly
+    call assert_equal('no process', string(ch_getjob(handle)))
+  endif
 
   " Simple string request and reply.
   call assert_equal('got it', ch_evalexpr(handle, 'hello!'))
index 4d8c525005dd79abaf10db5c3b5e82eb06fb2d41..92fb02a7dd550b5115c46a2b264c1c6bc6aacbb2 100644 (file)
@@ -743,6 +743,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1503,
 /**/
     1502,
 /**/