mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-14 15:16:40 +00:00
getContactByIdx() indexes the raw contacts[] table directly, whose first MAX_ANON_CONTACTS (8) slots are reserved for anon requests -- getNumContacts() already excludes them from its count, so real contacts start at index MAX_ANON_CONTACTS, not 0 (NearbyScreen.h's own contact scan already applies this offset; its comment documents why). MessagesScreen.h's buildContactList() didn't, so its loop only ever read the reserved anon slots (empty name, type 0) for any total at or under MAX_ANON_CONTACTS -- e.g. a device with exactly one known contact would show "SELECT CONTACT" / "No favourites" with an empty list forever, regardless of the dm_show_all/fav_only setting or that contact's own favourite flag. Reproduced live in the browser sim: a fresh companion_radio instance with one real ADV_TYPE_CHAT contact showed nothing until this fix. Also fixed _sorted[]'s stored index (was the bare loop counter, needed to be the raw table index every other call site in the file already assumes) and the same missing-offset bug in BotScreen.h's room-contact counter and MessageHistory.h's pub_key-prefix contact lookup. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>