DoConv :1: illegal undefined/null use Error.

So I just updated to GM 2 version 2.2.2 and now I get this error about DoConv :1: illegal undefined/null use. I've never seen this error before and I can't figure it out.
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_controller:
DoConv :1: illegal undefined/null use
at gml_Object_obj_controller_Step_0 (line 376) - with unit
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_controller_Step_0 (line 376)gml_Object_obj_controller_Step_0 (line 376)

Here is the code:
if ds_list_size(global.control_group_1) > 0
{
//LOOP THROUGH THE GROUP TO SELECT THEM ALL
for (i = 0; i <= list_size; i += 1)
{
unit = ds_list_find_value(global.control_group_1, i);
with unit
{
selected = true
}
}
}

Do you see what the problem is? Thanks!
 

CloseRange

Member
after unit = ....
try adding:
Code:
if(is_undefined(unity)) continue;
unit might be undefined causing errors because you can't run 'with' on an undefined.
 

FrostyCat

Redemption Seeker
Your loop is going one iteration too far and unit is becoming undefined on the last iteration. The consistency change in 2.2.2 is now pointing out a problem that has previously been swept under the rug.
Code:
for (i = 0; i < list_size; i += 1)
{
    unit = ds_list_find_value(global.control_group_1, i);
Remember: To iterate n times:
Code:
// Starting from 0
for (var i = 0; i < n; i++)

// Starting from 1
for (var i = 1; i <= n; i++)
 
Top