Page 1 of 1

[Bug]Crash When Iterating Over Global Table

Posted: Thu Jan 30, 2020 5:28 pm
by Centauri Soldier
Occasionally, when I try to iterate through a global table (which was declared in Globals), I get an error: bad arguement #1 to 'for iterator' (table expected, got nil);

Now, I know for a fact that this table is not nil, it is set once and never changes. But, sometimes, the program runs fine and other times it gives this error. On the times when it gives the error, I click the bebug error (presumably to open the section where the error occured) and SDStudio crashes.

It seems to happen more often if I have edited Globals recently.

EDIT: Okay, I've narrowed down a little further,

I've got a combo box called cmb_classes. The combobox is set to autosort.

In the OnCreate event of my window I have this code.

Code: Select all

ComboBox:DeleteAllItems(cmb_classes);
ComboBox:DeleteAllItems(cmb_types);

for sClass, tTypes in pairs(_tClassAndTypes) do
	ComboBox:AddItem(cmb_classes, sClass, "");
end
Now, sometimes when I start my program, the combobox is autosorted and sometimes it is not (this is unexpected behaviour). Whether or not it is autosorted is totally random. Whenever it does get sorted, I get the error and the subsequent crash. Whenever it does not get sorted, everything works fine.

Re: [Bug]Crash When Iterating Over Global Table

Posted: Thu Jan 30, 2020 5:51 pm
by Serkan
Can you please share a simple demo of the project that you experience the issues

Re: [Bug]Crash When Iterating Over Global Table

Posted: Fri Jan 31, 2020 8:02 pm
by Centauri Soldier
I'm sorry, I cannot. I can tell you how to replicate the behaviour though. If you require an external file which has an error, try to click on the debug link and the program will often crash.

Re: [Bug]Crash When Iterating Over Global Table

Posted: Fri Jan 31, 2020 9:18 pm
by Centauri Soldier
Nevermind this thread, you offered a solution in another thread regarding Application.LoadFile in the next update.