From 5641896ed2ec1d31ed2764ef7499d0a25141fc77 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 30 May 2023 23:07:34 -0700 Subject: [PATCH] Check for nil connected peripheral --- Meshtastic/Helpers/BLEManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 8bef3fcc..e1f20743 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -445,12 +445,12 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject { } } // Channels - if decodedInfo.channel.isInitialized { + if decodedInfo.channel.isInitialized && connectedPeripheral != nil { nowKnown = true channelPacket(channel: decodedInfo.channel, fromNum: connectedPeripheral.num, context: context!) } // Config - if decodedInfo.config.isInitialized && !invalidVersion { + if decodedInfo.config.isInitialized && !invalidVersion && connectedPeripheral != nil { nowKnown = true localConfig(config: decodedInfo.config, context: context!, nodeNum: self.connectedPeripheral.num, nodeLongName: self.connectedPeripheral.longName)