The $fields array doesn't always start with the key 0. This PR uses reset to get the first item.
Testing Instructions
Create multiple custom fields for contacts and set the "edit value" permissions so it is allowed by public. Set the fields to different positions (unter tab options -> automatic display)
Edit a contact to add some value to those fields.
View that contact in frontend.
Before PR you get multiple notices after PR they are gone.
I have tested this item✅ successfully on 188cfeb
Notices where gone after patch install
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12729.