From 30d150e3aa14765f623abb3fa269119e53c3224f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 7 Jul 2025 10:49:52 -0500 Subject: [PATCH] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Meshtastic/Helpers/BLEManager.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 2cfc90dd..e7cc671a 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -499,7 +499,11 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let traceRoute = TraceRouteEntity(context: context) let nodes = NodeInfoEntity.fetchRequest() - nodes.predicate = NSPredicate(format: "num IN %@", [destNum, self.connectedPeripheral?.num ?? 0]) + if let connectedNum = self.connectedPeripheral?.num { + nodes.predicate = NSPredicate(format: "num IN %@", [destNum, connectedNum]) + } else { + nodes.predicate = NSPredicate(format: "num == %@", destNum) + } do { let fetchedNodes = try context.fetch(nodes) let receivingNode = fetchedNodes.first(where: { $0.num == destNum })