Fix known_only panic by short circuiting for NULL before checking has_user (#3352)

This commit is contained in:
Ben Meadors 2024-03-08 08:31:49 -06:00 committed by GitHub
parent 585805c3b9
commit 7da1153c2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -297,7 +297,7 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
return false;
if (config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_KNOWN_ONLY &&
!nodeDB.getMeshNode(p->from)->has_user) {
(nodeDB.getMeshNode(p->from) == NULL || !nodeDB.getMeshNode(p->from)->has_user)) {
LOG_DEBUG("Node 0x%x not in NodeDB. Rebroadcast mode KNOWN_ONLY will ignore packet\n", p->from);
return false;
}