patch 7.4.1264
Problem: Crash when receiving an empty array.
Solution: Check for array with wrong number of arguments. (Damien)
diff --git a/src/eval.c b/src/eval.c
index 50b1b2a..33ec495 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -9875,18 +9875,12 @@
{
if (channel_read_json_block(ch_idx, id, &listtv) == OK)
{
- if (listtv->v_type == VAR_LIST)
- {
- list_T *list = listtv->vval.v_list;
+ list_T *list = listtv->vval.v_list;
- if (list->lv_len == 2)
- {
- /* Move the item from the list and then change the type to
- * avoid the value being freed. */
- *rettv = list->lv_last->li_tv;
- list->lv_last->li_tv.v_type = VAR_NUMBER;
- }
- }
+ /* Move the item from the list and then change the type to
+ * avoid the value being freed. */
+ *rettv = list->lv_last->li_tv;
+ list->lv_last->li_tv.v_type = VAR_NUMBER;
clear_tv(listtv);
}
}