Перейти к содержимому

List index out of bounds 0 как исправить

  • автор:

Ошибка: list index out of bounds(0)

Ошибка List index out of bounds (0)
Здравствуйте я пытался сделать лабарторную работу но выходит ошибка скрин: как можно его.

Ошибка: List index out of bounds
Всем добрый вечер!Есть Программа которая по нажатию одной клавиши находит и записывает в listbox.

Ошибка: List index out of bounds (0)
хочу программу битового просмоторщика но уже на этапе открытия файла возникает ошибка Project.exe.

Ошибка: List index out of bounds(0)
Хочу создать список номеров, чтоб к каждому человеку подходил свой номер, на финальном этапе.

List index out of bounds: 0

I have declared a two dimensional array «S» in a class as follows:

Im getting a List index out of bounds: 0 at this line:

It seems that its not calling the List correctly,

Can someone please tell me what’s wrong?

1 Answer 1

I don’t have any experience in apex-code, but I’d guess that you haven’t initialised the List elsewhere in the code, or at least not initialised the inner List.

Putting this in context with a well known language such as C# or Java, the initialisation would look something like this:

Solve: System.ListException: List index out of bounds: 0

The problem is in the line siteNAme = con[0].Site__r.Name; after the query. Please can you help me?

i’m not able to find the problem.

Thanks in advantage for any advice.

ca_peterson's user avatar

Enry's user avatar

1 Answer 1

con[] has no elements so trying to access the 0 index element will cause the list index out of bounds excpetion.

To protect against this you could change your code to first check to see if the returned List is not empty:

You may want to add in an else condition to handle the case where there is no 0th element as well which you could do in an else clause:

Инсталляция, монтаж » Помогите решить вопрос с ошибкой list index out of bound 0

Здравствуйте. установил Orion 1.20 (устанавливал и 1.12 с дополнением ) происходит следующее, призапуске АБД вылетает ошибка "list index out of bound 0" (системник новый, стоит windows 8.1 ( на свой дровянной ноут устанавливаю, всё работает)).

в логе ошибок ориона следующее:

hint соединение с сервером
error ошибка приложения: list index out of bounds (0)
error Event translate error: не удается открыть базу данных "orion120" запрашиваемую именем входа. Не удалось выполнить вход
(INSERT INTO pLogData (Guid, NumCom, TimeVal, IDComp, Par1, Par2, Par3, Par4, Event, IndexKey, RazdIndex, HozOrgan, HozGuest, Remark, DoorIndex, Mode, DeviceTime, VEvent, ZReserv, ZoneIndex, ReaderIndex, Sing, tpRzdIndex, tpPar4, IndexZone, tpIndex ) VALUES (Newld(), null, :pTimeVal, 0, null, null, null, null, 1652, null, null, null, null, :pRemark, null, null, :pDeviceTime, null, null, -1, null, null, null, null, null, null )

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *