         }
         
         let urlPrefix: String = urlPrefixForMapApp(mapApp)
-        return application.canOpenURL(URL(string: urlPrefix)!)
+        guard let url = URL(string: urlPrefix) else {
+            return false
+        }
+        return application.canOpenURL(url)
     }
 
     /**

                               toDirection.location.coordinate.longitude,
                               toDirection.name) as String
            } else {
                url = NSString(format: "here-route://%f,%f,%@/%f,%f,%@",
                               fromDirections.location.coordinate.latitude,
                               fromDirections.location.coordinate.longitude,
                               fromDirections.name,

                }
            }
            
            urlString = NSString(format: "citymapper://directions?%@", params.componentsJoined(by: "&")) as String
        case .navigon:
            var name: String = "Destination"
            if !toDirection.name.isEmpty {
                name = toDirection.name
            }
            
            urlString = NSString(format: "navigon://coordinate/%@/%f/%f",
                           urlEncode(name as NSString),
                           toDirection.location.coordinate.longitude,
                           toDirection.location.coordinate.latitude) as String
