Mercurial > vim
comparison src/vim9compile.c @ 22021:514d622473af v8.2.1560
patch 8.2.1560: using NULL pointers in some code
Commit: https://github.com/vim/vim/commit/9c2b06637b32742cac11bfd66b1a4e84583c6c2e
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 1 19:56:15 2020 +0200
patch 8.2.1560: using NULL pointers in some code
Problem: Using NULL pointers in some code. (James McCoy)
Solution: Avoid adding to a NULL pointer. Use byte as unsigned.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 01 Sep 2020 20:00:03 +0200 |
parents | a9e60176dcd3 |
children | 6941d3205be9 |
comparison
equal
deleted
inserted
replaced
22020:8449d4a87818 | 22021:514d622473af |
---|---|
1145 if ((isn = generate_instr(cctx, ISN_NEWLIST)) == NULL) | 1145 if ((isn = generate_instr(cctx, ISN_NEWLIST)) == NULL) |
1146 return FAIL; | 1146 return FAIL; |
1147 isn->isn_arg.number = count; | 1147 isn->isn_arg.number = count; |
1148 | 1148 |
1149 // get the member type from all the items on the stack. | 1149 // get the member type from all the items on the stack. |
1150 member = get_member_type_from_stack( | 1150 if (count == 0) |
1151 member = &t_void; | |
1152 else | |
1153 member = get_member_type_from_stack( | |
1151 ((type_T **)stack->ga_data) + stack->ga_len, count, 1, | 1154 ((type_T **)stack->ga_data) + stack->ga_len, count, 1, |
1152 cctx->ctx_type_list); | 1155 cctx->ctx_type_list); |
1153 type = get_list_type(member, cctx->ctx_type_list); | 1156 type = get_list_type(member, cctx->ctx_type_list); |
1154 | 1157 |
1155 // drop the value types | 1158 // drop the value types |
1178 RETURN_OK_IF_SKIP(cctx); | 1181 RETURN_OK_IF_SKIP(cctx); |
1179 if ((isn = generate_instr(cctx, ISN_NEWDICT)) == NULL) | 1182 if ((isn = generate_instr(cctx, ISN_NEWDICT)) == NULL) |
1180 return FAIL; | 1183 return FAIL; |
1181 isn->isn_arg.number = count; | 1184 isn->isn_arg.number = count; |
1182 | 1185 |
1183 member = get_member_type_from_stack( | 1186 if (count == 0) |
1187 member = &t_void; | |
1188 else | |
1189 member = get_member_type_from_stack( | |
1184 ((type_T **)stack->ga_data) + stack->ga_len, count, 2, | 1190 ((type_T **)stack->ga_data) + stack->ga_len, count, 2, |
1185 cctx->ctx_type_list); | 1191 cctx->ctx_type_list); |
1186 type = get_dict_type(member, cctx->ctx_type_list); | 1192 type = get_dict_type(member, cctx->ctx_type_list); |
1187 | 1193 |
1188 // drop the key and value types | 1194 // drop the key and value types |