Calculating index from a selected entry in dropdown fails

Hi all,

first of all I want to say that I am very new to Unity and have just some basic knowledge in programing. So pls have mercy with me if I ask stupid question :-/

So this is my problem:
For a school project me and a few other students need to build an app which allows users to label gameobjects and these labels will be stored in a list for each gameobject - however these gameobjects are also stored in a list (so list gameobjects contain for each gameobject a list of labels assigned to).
Beside entering a label, the user should be able to delete also labels.
And here I have the problem.

When the user opens the delete button to initiate the deletion, a panel containing a dropdown is displayed. This dropdown contains all labels which was assigned to the corresponding gameobject (so each entry from the label list for the gameobject is displayed in the dropdown).
when the user selects one entry and clicks in the panel on delete, the selected label should be removed from the list.
In my code I was logging the label list before deletion and after deletion. But there is somehow a problem and i get a NRE:
NullReferenceException: Object reference not set to an instance of an object. Deletion.Delete() (at Assets/Scripts/Deletion.cs:71).
The program is executed till line 69.
If I calculate the index by providing a specific string - everything works fine.
But I would need to find out the index of the selected item in dropdown, which is available in DropDownHandler, to which I am trying to access. But something is wrong :frowning:

This is my code:

[/code]

Does anyone know where is my mistake? Would be very thankful if someone could help…

solved it by myselves