comparison src/eval.c @ 7937:2e905dfc6999 v7.4.1264

commit https://github.com/vim/vim/commit/6076fe1986255d32b7a078a28bf9e7bea19d6f30 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 5 22:49:56 2016 +0100 patch 7.4.1264 Problem: Crash when receiving an empty array. Solution: Check for array with wrong number of arguments. (Damien)
author Christian Brabandt <cb@256bit.org>
date Fri, 05 Feb 2016 23:00:05 +0100
parents 3f2e0b62003d
children e875f0fbd9c0
comparison
equal deleted inserted replaced
7936:a058fba2b5fd 7937:2e905dfc6999
9873 vim_free(text); 9873 vim_free(text);
9874 if (ch_idx >= 0) 9874 if (ch_idx >= 0)
9875 { 9875 {
9876 if (channel_read_json_block(ch_idx, id, &listtv) == OK) 9876 if (channel_read_json_block(ch_idx, id, &listtv) == OK)
9877 { 9877 {
9878 if (listtv->v_type == VAR_LIST) 9878 list_T *list = listtv->vval.v_list;
9879 { 9879
9880 list_T *list = listtv->vval.v_list; 9880 /* Move the item from the list and then change the type to
9881 9881 * avoid the value being freed. */
9882 if (list->lv_len == 2) 9882 *rettv = list->lv_last->li_tv;
9883 { 9883 list->lv_last->li_tv.v_type = VAR_NUMBER;
9884 /* Move the item from the list and then change the type to
9885 * avoid the value being freed. */
9886 *rettv = list->lv_last->li_tv;
9887 list->lv_last->li_tv.v_type = VAR_NUMBER;
9888 }
9889 }
9890 clear_tv(listtv); 9884 clear_tv(listtv);
9891 } 9885 }
9892 } 9886 }
9893 } 9887 }
9894 9888