From b4b158aabf0d27172da570108d37efddce5d833b Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 11 Nov 2022 19:21:52 -0800 Subject: [PATCH] Fix a couple of nils --- Meshtastic/Helpers/BLEManager.swift | 4 ++-- Meshtastic/MeshtasticApp.swift | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 84214ffb..238eb167 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -520,8 +520,8 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph if nodeInfo != nil { if self.connectedPeripheral != nil && self.connectedPeripheral.num == nodeInfo!.num { if nodeInfo!.user != nil { - connectedPeripheral.shortName = nodeInfo!.user!.shortName ?? "????" - connectedPeripheral.longName = nodeInfo!.user!.longName ?? "Unknown" + connectedPeripheral.shortName = nodeInfo?.user?.shortName ?? "????" + connectedPeripheral.longName = nodeInfo?.user?.longName ?? "Unknown" } } } diff --git a/Meshtastic/MeshtasticApp.swift b/Meshtastic/MeshtasticApp.swift index 0eae4e88..aa567280 100644 --- a/Meshtastic/MeshtasticApp.swift +++ b/Meshtastic/MeshtasticApp.swift @@ -7,15 +7,13 @@ import CoreData struct MeshtasticAppleApp: App { let persistenceController = PersistenceController.shared - @ObservedObject private var bleManager: BLEManager = BLEManager.shared @ObservedObject private var userSettings: UserSettings = UserSettings() + @Environment(\.scenePhase) var scenePhase @State var saveChannels = false @State var incomingUrl: URL? @State var channelSettings: String? - - @Environment(\.scenePhase) var scenePhase var body: some Scene { WindowGroup {