comparison src/eval.c @ 8424:be45d4921f1f v7.4.1503

commit https://github.com/vim/vim/commit/839fd11d7ed1a96bace3159c4d1861658864aae3 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 6 21:34:03 2016 +0100 patch 7.4.1503 Problem: Crash when using ch_getjob(). (Damien) Solution: Check for a NULL job.
author Christian Brabandt <cb@256bit.org>
date Sun, 06 Mar 2016 21:45:04 +0100
parents 3b9a306724ec
children 800423dbc260
comparison
equal deleted inserted replaced
8423:a7245a1fb5a7 8424:be45d4921f1f
15247 # endif 15247 # endif
15248 mch_start_job((char *)cmd, job, &opt); 15248 mch_start_job((char *)cmd, job, &opt);
15249 #endif 15249 #endif
15250 15250
15251 #ifdef FEAT_CHANNEL 15251 #ifdef FEAT_CHANNEL
15252 /* If the channel is reading from a buffer, write lines now. */
15252 channel_write_in(job->jv_channel); 15253 channel_write_in(job->jv_channel);
15253 #endif 15254 #endif
15254 15255
15255 theend: 15256 theend:
15256 #ifdef USE_ARGV 15257 #ifdef USE_ARGV
22599 return buf; 22600 return buf;
22600 case VAR_JOB: 22601 case VAR_JOB:
22601 #ifdef FEAT_JOB 22602 #ifdef FEAT_JOB
22602 { 22603 {
22603 job_T *job = varp->vval.v_job; 22604 job_T *job = varp->vval.v_job;
22604 char *status = job->jv_status == JOB_FAILED ? "fail" 22605 char *status;
22606
22607 if (job == NULL)
22608 return (char_u *)"no process";
22609 status = job->jv_status == JOB_FAILED ? "fail"
22605 : job->jv_status == JOB_ENDED ? "dead" 22610 : job->jv_status == JOB_ENDED ? "dead"
22606 : "run"; 22611 : "run";
22607 # ifdef UNIX 22612 # ifdef UNIX
22608 vim_snprintf((char *)buf, NUMBUFLEN, 22613 vim_snprintf((char *)buf, NUMBUFLEN,
22609 "process %ld %s", (long)job->jv_pid, status); 22614 "process %ld %s", (long)job->jv_pid, status);