mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 10:16:11 +00:00
fix: check getContactByIdx return value in DM context menu handler
Prevents using uninitialized ContactInfo if the lookup fails. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
eb0f436924
commit
60867a4c9e
@@ -1727,13 +1727,14 @@ public:
|
|||||||
if (c == KEY_DOWN && _ctx_sel < 1) { _ctx_sel++; return true; }
|
if (c == KEY_DOWN && _ctx_sel < 1) { _ctx_sel++; return true; }
|
||||||
if (c == KEY_ENTER && _num_contacts > 0) {
|
if (c == KEY_ENTER && _num_contacts > 0) {
|
||||||
ContactInfo ci;
|
ContactInfo ci;
|
||||||
the_mesh.getContactByIdx(_sorted[_contact_sel], ci);
|
if (the_mesh.getContactByIdx(_sorted[_contact_sel], ci)) {
|
||||||
if (_ctx_sel == 0) {
|
if (_ctx_sel == 0) {
|
||||||
_task->clearDMUnread(ci.id.pub_key);
|
_task->clearDMUnread(ci.id.pub_key);
|
||||||
} else {
|
} else {
|
||||||
uint8_t nstate = dmNotifState(ci.id.pub_key);
|
uint8_t nstate = dmNotifState(ci.id.pub_key);
|
||||||
setDmNotifState(ci.id.pub_key, (nstate + 1) % 3);
|
setDmNotifState(ci.id.pub_key, (nstate + 1) % 3);
|
||||||
_ctx_dirty = true;
|
_ctx_dirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user