From b6a13f1114ed2c259881fd8761832a5aaae97d3b Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 28 Jun 2025 22:54:03 -0500 Subject: [PATCH] Add check for theoretically impossible comparison, and drop nodenum comparison (#7165) --- src/mesh/NodeDB.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 8990d4b4f..bd4911a9b 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1696,6 +1696,8 @@ void NodeDB::sortMeshDB() lastSort = millis(); std::sort(meshNodes->begin(), meshNodes->begin() + numMeshNodes, [](const meshtastic_NodeInfoLite &a, const meshtastic_NodeInfoLite &b) { + if (a.num == myNodeInfo.my_node_num && b.num == myNodeInfo.my_node_num) // in theory impossible + return false; if (a.num == myNodeInfo.my_node_num) { return true; } @@ -1706,9 +1708,7 @@ void NodeDB::sortMeshDB() bool bFav = b.is_favorite; if (aFav != bFav) return aFav; - if (a.last_heard != b.last_heard) - return a.last_heard > b.last_heard; - return a.num > b.num; + return a.last_heard > b.last_heard; }); } }