Page 1 of 1
List index out of bounds
Posted: 2009-06-05 11:05:53
by Toadcop
well. i needed to add one files into the framemovie an in general into the tool. i have done this everything seems to work ok. (it saves the new field to the amc file and also load it etc etc.)
BUT
1) after the tool is launched (loaded) i get "List index out of bounds(31)" error (due i increased the field count to 32 from 31)
2) also this error appears if i enter export module (but after all seems to work ok)
3) and i even can't lanuch the "import info from i-net" it bumps 2 times this error and nothing opens (no new window)
i know it comes from ElTree (actually ElList) but i can't understand why -.-
and i am newbie in delphi so some things are confusing for me =)
the version of AMC is 3.5.1.1
i hope you can help me ^_^
Posted: 2009-06-05 15:38:06
by antp
Well that's maybe not really for the bug section since it is then a bug that you created yourself

The fact that it says that the error comes from ElList just means that the first action which caused that was from ElList, but that's just because it happens when refreshing/selecting the list.
To know precisely where it happens you have to enable the "stop on delphi exceptions" in the "debugger options" of Delphi ("languages options" page of that window).
Then it will show in the code where the "index out of bounds" occured.
Using the call stack ("debug" menu) you can see which function called that function, and with which parameters, and possibly put a breakpoint at some point to trace the execution step by step to see what causes the error.
Posted: 2009-06-06 11:14:25
by Toadcop
well tnx.
it's kind a wierd... i returned fieldCount to 31 and made a new var (for the new fields) bla bla... and it seems to work now. aka there are some problems with fieldCount... so it's kind a "bug" :P
but i solved it and it's cool =)
Posted: 2009-06-06 15:54:18
by antp
fieldCount is not used together with the variables, but with lists.
With a quick check the only thing that I could see as problem is that the new field is not added to strFields like the others are.
But if you could check where it crash with the error, it would help of course.
I do not know what will be the side effects if you just added a field without updating these lists (fieldCount & strFields)
Posted: 2009-06-06 17:04:57
by Toadcop
strFields - is located in field.pas ? if so...
i added "Path" from the begining...
// *viewing the code*... yes i did.
Code: Select all
strXmlFields: array [fieldLow..fieldCountX-1] of string = (
'Number',
'Checked',
'MediaLabel',
'MediaType',
'Source',
'Date',
'Borrower',
'Rating',
'OriginalTitle',
'TranslatedTitle',
'FormattedTitle',
'Director',
'Producer',
'Country',
'Category',
'Year',
'Length',
'Actors',
'URL',
'Path',
'Description',
'Comments',
'VideoFormat',
'VideoBitrate',
'AudioFormat',
'AudioBitrate',
'Resolution',
'Framerate',
'Languages',
'Subtitles',
'Size',
'Disks'
); //
{$IFNDEF DLLMode}
strFields: TStrings;
strFieldPicture: string;
strSqlFields: array [0..fieldCountX-1] of string = (
'NUM',
'CHECKED',
'MEDIA',
'MEDIATYPE',
'SOURCE',
'DATEADD',
'BORROWER',
'RATING',
'ORIGINALTITLE',
'TRANSLATEDTITLE',
'FORMATTEDTITLE',
'DIRECTOR',
'PRODUCER',
'COUNTRY',
'CATEGORY',
'YEAR',
'LENGTH',
'ACTORS',
'URL',
'PATH',
'DESCRIPTION',
'COMMENTS',
'VIDEOFORMAT',
'VIDEOBITRATE',
'AUDIOFORMAT',
'AUDIOBITRATE',
'RESOLUTION',
'FRAMERATE',
'LANGUAGES',
'SUBTITLES',
'FILESIZE',
'DISKS'
);
well weird but now it works =) (as i posted before)
tnx for help !
Posted: 2009-06-06 17:24:30
by antp
What's that "fieldCountX" ? If it is different than fieldCount it is normal that it crashes.
Posted: 2009-06-06 18:04:24
by Toadcop
no otherwise =) it doesnt crash if i replace function which does work with fields directly.
before i didn't change anything except fieldCount. (the value)
imagine what there is no X at the end

after i added my var and replaced fieldCount in some places. it began to work with out errors =) (and returned fieldCount to 31) and fieldCount = 32 =)
a mystery ? =)
// now i continue to post here maybe to help to solve the root problem not my own.
Posted: 2009-06-08 07:46:47
by antp
You'll lose the last field of the list with that then.
If you increase fieldcount and add update the list of fields so last one = fieldcount-1, and add the field in the lists (strxmlfields and so on) that should work.
If you start to change the fieldcount where it is used you'll get some strange random things, because lists of fields won't match.
Well you do what you want

But I assure you that if you have bugs that's due to the changes and not to a bug originally in the code.
Previously I already added fields, and that to easily do that that the list is handled in that way, with fieldcount.