@@ -101,6 +101,13 @@ extern "C" void MCListFetchElementOf(index_t p_index, MCProperListRef p_target,
101101{
102102 uindex_t t_start, t_count;
103103 MCChunkGetExtentsOfElementChunkByExpression (p_target, p_index, t_start, t_count);
104+
105+ if (t_count == 0 )
106+ return ;
107+
108+ if (t_start + t_count > MCProperListGetLength (p_target))
109+ return ;
110+
104111 r_output = MCValueRetain (MCProperListFetchElementAtIndex (p_target, t_start));
105112}
106113
@@ -109,6 +116,12 @@ extern "C" void MCListStoreElementOf(MCValueRef p_value, index_t p_index, MCProp
109116 uindex_t t_start, t_count;
110117 MCChunkGetExtentsOfElementChunkByExpression (x_target, p_index, t_start, t_count);
111118
119+ if (t_count == 0 )
120+ return ;
121+
122+ if (t_start + t_count > MCProperListGetLength (x_target))
123+ return ;
124+
112125 MCAutoProperListRef t_mutable_list;
113126 if (!MCProperListMutableCopy (x_target, &t_mutable_list))
114127 return ;
@@ -127,6 +140,13 @@ extern "C" void MCListFetchElementRangeOf(index_t p_start, index_t p_finish, MCP
127140{
128141 uindex_t t_start, t_count;
129142 MCChunkGetExtentsOfElementChunkByRange (p_target, p_start, p_finish, t_start, t_count);
143+
144+ if (t_count == 0 )
145+ return ;
146+
147+ if (t_start + t_count > MCProperListGetLength (p_target))
148+ return ;
149+
130150 MCProperListCopySublist (p_target, MCRangeMake (t_start, t_count), r_output);
131151}
132152
@@ -135,6 +155,12 @@ extern "C" void MCListStoreElementRangeOf(MCValueRef p_value, index_t p_start, i
135155 uindex_t t_start, t_count;
136156 MCChunkGetExtentsOfElementChunkByRange (x_target, p_start, p_finish, t_start, t_count);
137157
158+ if (t_count == 0 )
159+ return ;
160+
161+ if (t_start + t_count > MCProperListGetLength (x_target))
162+ return ;
163+
138164 MCAutoProperListRef t_mutable_list;
139165 if (!MCProperListMutableCopy (x_target, &t_mutable_list))
140166 return ;
@@ -165,6 +191,12 @@ extern "C" void MCListStoreAfterElementOf(MCValueRef p_value, index_t p_index, M
165191 t_start += t_count;
166192 MCChunkGetExtentsOfElementChunkByExpression (x_target, p_index, t_start, t_count);
167193
194+ if (t_count == 0 )
195+ return ;
196+
197+ if (t_start + t_count > MCProperListGetLength (x_target))
198+ return ;
199+
168200 MCAutoProperListRef t_mutable_list;
169201 if (!MCProperListMutableCopy (x_target, &t_mutable_list))
170202 return ;
@@ -183,6 +215,12 @@ extern "C" void MCListStoreBeforeElementOf(MCValueRef p_value, index_t p_index,
183215 uindex_t t_start, t_count;
184216 MCChunkGetExtentsOfElementChunkByExpression (x_target, p_index, t_start, t_count);
185217
218+ if (t_count == 0 )
219+ return ;
220+
221+ if (t_start + t_count > MCProperListGetLength (x_target))
222+ return ;
223+
186224 MCAutoProperListRef t_mutable_list;
187225 if (!MCProperListMutableCopy (x_target, &t_mutable_list))
188226 return ;
@@ -203,6 +241,12 @@ extern "C" void MCListSpliceIntoElementRangeOf(MCProperListRef p_list, index_t p
203241 uindex_t t_start, t_count;
204242 MCChunkGetExtentsOfElementChunkByRange (x_target, p_start, p_finish, t_start, t_count);
205243
244+ if (t_count == 0 )
245+ return ;
246+
247+ if (t_start + t_count > MCProperListGetLength (x_target))
248+ return ;
249+
206250 MCAutoProperListRef t_mutable_list;
207251 if (!MCProperListMutableCopy (x_target, &t_mutable_list))
208252 return ;
@@ -227,6 +271,12 @@ extern "C" void MCListSpliceBeforeElementOf(MCProperListRef p_list, index_t p_in
227271 uindex_t t_start, t_count;
228272 MCChunkGetExtentsOfElementChunkByExpression (x_target, p_index, t_start, t_count);
229273
274+ if (t_count == 0 )
275+ return ;
276+
277+ if (t_start + t_count > MCProperListGetLength (x_target))
278+ return ;
279+
230280 MCAutoProperListRef t_mutable_list;
231281 if (!MCProperListMutableCopy (x_target, &t_mutable_list))
232282 return ;
@@ -245,6 +295,12 @@ extern "C" void MCListSpliceAfterElementOf(MCProperListRef p_list, index_t p_ind
245295 uindex_t t_start, t_count;
246296 MCChunkGetExtentsOfElementChunkByExpression (x_target, p_index, t_start, t_count);
247297
298+ if (t_count == 0 )
299+ return ;
300+
301+ if (t_start + t_count > MCProperListGetLength (x_target))
302+ return ;
303+
248304 t_start += t_count;
249305
250306 MCAutoProperListRef t_mutable_list;
0 commit comments