diff --git a/Meshtastic/AppIntents/SendWaypointIntent.swift b/Meshtastic/AppIntents/SendWaypointIntent.swift index e41732db..fb0f97c3 100644 --- a/Meshtastic/AppIntents/SendWaypointIntent.swift +++ b/Meshtastic/AppIntents/SendWaypointIntent.swift @@ -89,7 +89,11 @@ struct SendWaypointIntent: AppIntent { } if isLocked { - newWaypoint.lockedTo = UInt32(BLEManager.shared.connectedPeripheral!.num) + if let connectedPeripheral = BLEManager.shared.connectedPeripheral { + newWaypoint.lockedTo = UInt32(connectedPeripheral.num) + } else { + throw AppIntentErrors.AppIntentError.notConnected + } } if !BLEManager.shared.sendWaypoint(waypoint: newWaypoint) {