mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-03 04:15:53 +00:00
Add check for theoretically impossible comparison, and drop nodenum comparison (#7165)
This commit is contained in:
parent
2bcf608654
commit
b6a13f1114
@ -1696,6 +1696,8 @@ void NodeDB::sortMeshDB()
|
|||||||
lastSort = millis();
|
lastSort = millis();
|
||||||
std::sort(meshNodes->begin(), meshNodes->begin() + numMeshNodes,
|
std::sort(meshNodes->begin(), meshNodes->begin() + numMeshNodes,
|
||||||
[](const meshtastic_NodeInfoLite &a, const meshtastic_NodeInfoLite &b) {
|
[](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) {
|
if (a.num == myNodeInfo.my_node_num) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1706,9 +1708,7 @@ void NodeDB::sortMeshDB()
|
|||||||
bool bFav = b.is_favorite;
|
bool bFav = b.is_favorite;
|
||||||
if (aFav != bFav)
|
if (aFav != bFav)
|
||||||
return aFav;
|
return aFav;
|
||||||
if (a.last_heard != b.last_heard)
|
return a.last_heard > b.last_heard;
|
||||||
return a.last_heard > b.last_heard;
|
|
||||||
return a.num > b.num;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user