comparison src/vim9type.c @ 22804:af26fadf333d v8.2.1950

patch 8.2.1950: Vim9: crash when compiling function fails when getting type Commit: https://github.com/vim/vim/commit/9c13f76275047a4d6302c077fb40bc9c397ff027 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Nov 4 12:00:53 2020 +0100 patch 8.2.1950: Vim9: crash when compiling function fails when getting type Problem: Vim9: crash when compiling function fails when getting type. Solution: Handle NULL type. (closes https://github.com/vim/vim/issues/7253)
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 Nov 2020 12:15:03 +0100
parents 4c21f7f6f9e3
children a8bccb0634bc
comparison
equal deleted inserted replaced
22803:afac564db1c3 22804:af26fadf333d
106 get_list_type(type_T *member_type, garray_T *type_gap) 106 get_list_type(type_T *member_type, garray_T *type_gap)
107 { 107 {
108 type_T *type; 108 type_T *type;
109 109
110 // recognize commonly used types 110 // recognize commonly used types
111 if (member_type->tt_type == VAR_ANY) 111 if (member_type == NULL || member_type->tt_type == VAR_ANY)
112 return &t_list_any; 112 return &t_list_any;
113 if (member_type->tt_type == VAR_VOID 113 if (member_type->tt_type == VAR_VOID
114 || member_type->tt_type == VAR_UNKNOWN) 114 || member_type->tt_type == VAR_UNKNOWN)
115 return &t_list_empty; 115 return &t_list_empty;
116 if (member_type->tt_type == VAR_BOOL) 116 if (member_type->tt_type == VAR_BOOL)
135 get_dict_type(type_T *member_type, garray_T *type_gap) 135 get_dict_type(type_T *member_type, garray_T *type_gap)
136 { 136 {
137 type_T *type; 137 type_T *type;
138 138
139 // recognize commonly used types 139 // recognize commonly used types
140 if (member_type->tt_type == VAR_ANY) 140 if (member_type == NULL || member_type->tt_type == VAR_ANY)
141 return &t_dict_any; 141 return &t_dict_any;
142 if (member_type->tt_type == VAR_VOID 142 if (member_type->tt_type == VAR_VOID
143 || member_type->tt_type == VAR_UNKNOWN) 143 || member_type->tt_type == VAR_UNKNOWN)
144 return &t_dict_empty; 144 return &t_dict_empty;
145 if (member_type->tt_type == VAR_BOOL) 145 if (member_type->tt_type == VAR_BOOL)
406 } 406 }
407 407
408 408
409 /* 409 /*
410 * Return FAIL if "expected" and "actual" don't match. 410 * Return FAIL if "expected" and "actual" don't match.
411 * When "argidx" > 0 it is included in the error message.
411 */ 412 */
412 int 413 int
413 check_typval_type(type_T *expected, typval_T *actual_tv, int argidx) 414 check_typval_type(type_T *expected, typval_T *actual_tv, int argidx)
414 { 415 {
415 garray_T type_list; 416 garray_T type_list;