To: vim_dev@googlegroups.com Subject: Patch 7.4.1503 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1503 Problem: Crash when using ch_getjob(). (Damien) Solution: Check for a NULL job. Files: src/eval.c, src/testdir/test_channel.vim *** ../vim-7.4.1502/src/eval.c 2016-03-03 22:51:36.129809749 +0100 --- src/eval.c 2016-03-06 21:29:24.065291719 +0100 *************** *** 15249,15254 **** --- 15249,15255 ---- #endif #ifdef FEAT_CHANNEL + /* If the channel is reading from a buffer, write lines now. */ channel_write_in(job->jv_channel); #endif *************** *** 22601,22607 **** #ifdef FEAT_JOB { job_T *job = varp->vval.v_job; ! char *status = job->jv_status == JOB_FAILED ? "fail" : job->jv_status == JOB_ENDED ? "dead" : "run"; # ifdef UNIX --- 22602,22612 ---- #ifdef FEAT_JOB { job_T *job = varp->vval.v_job; ! 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 *** ../vim-7.4.1502/src/testdir/test_channel.vim 2016-03-06 16:38:23.119062186 +0100 --- src/testdir/test_channel.vim 2016-03-06 21:31:59.507633189 +0100 *************** *** 108,113 **** --- 108,117 ---- 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!')) *** ../vim-7.4.1502/src/version.c 2016-03-06 20:22:20.356165934 +0100 --- src/version.c 2016-03-06 21:30:10.468796535 +0100 *************** *** 745,746 **** --- 745,748 ---- { /* Add new patch number below this line */ + /**/ + 1503, /**/ -- It doesn't really matter what you are able to do if you don't do it. (Bram Moolenaar) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///