Mercurial > vim
diff src/eval.c @ 8070:e4c3f6720b03 v7.4.1329
commit https://github.com/vim/vim/commit/5cefd4098204b4677387511b586673649f2fab48
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 16 12:44:26 2016 +0100
patch 7.4.1329
Problem: Crash when using channel that failed to open.
Solution: Check for NULL. Update messages. (Yukihiro Nakadaira)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 16 Feb 2016 12:45:05 +0100 |
parents | 7fe3b9dc132b |
children | 7676818d486b |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -21828,7 +21828,10 @@ get_tv_string_buf_chk(typval_T *varp, ch channel_T *channel = varp->vval.v_channel; char *status = channel_status(channel); - vim_snprintf((char *)buf, NUMBUFLEN, + if (channel == NULL) + vim_snprintf((char *)buf, NUMBUFLEN, "channel %s", status); + else + vim_snprintf((char *)buf, NUMBUFLEN, "channel %d %s", channel->ch_id, status); return buf; } @@ -22467,7 +22470,8 @@ copy_tv(typval_T *from, typval_T *to) case VAR_CHANNEL: #ifdef FEAT_CHANNEL to->vval.v_channel = from->vval.v_channel; - ++to->vval.v_channel->ch_refcount; + if (to->vval.v_channel != NULL) + ++to->vval.v_channel->ch_refcount; break; #endif case VAR_STRING: