Create and objects in ArrayList when mouse is pressed

Thanks for your quick reply. Apparently it’s working, but I still don’t understand, why do I have to check if the size is greater than 0, to use the object inside the ArrayList !?