Fix a couple more potential crashes

This commit is contained in:
Garth Vander Houwen 2023-01-02 21:37:11 -08:00
parent 4467c7ab9e
commit 866d21246e
2 changed files with 2 additions and 2 deletions

View file

@ -1052,7 +1052,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
let binaryData: Data = try! toRadio.serializedData()
if connectedPeripheral!.peripheral.state == CBPeripheralState.connected {
self.connectedPeripheral.peripheral.writeValue(binaryData, for: self.TORADIO_characteristic, type: .withResponse)
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.lora.config.sent %@", comment: "Sent a LoRaConfig for: %@"), connectedPeripheral.num)
let logString = String.localizedStringWithFormat(NSLocalizedString("mesh.log.lora.config.sent %@", comment: "Sent a LoRaConfig for: %@"), String(connectedPeripheral.num))
MeshLogger.log("📻 \(logString)")
}
return true

View file

@ -31,7 +31,7 @@ struct MeshtasticAppleApp: App {
print("URL received \(userActivity)")
self.incomingUrl = userActivity.webpageURL
if self.incomingUrl!.absoluteString.lowercased().contains("meshtastic.org/e/#") {
if ((self.incomingUrl?.absoluteString.lowercased().contains("meshtastic.org/e/#")) != nil) {
if let components = self.incomingUrl?.absoluteString.components(separatedBy: "#") {
self.channelSettings = components.last!