         }
         
         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,

                           urlEncode(fromDirections.name as NSString),
                           Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String ?? "") as String
        }
        guard let url = URL(string: urlString) else {
            return false
        }
        if #available(iOS 10.0, *) {
            application.open(url, options: [:], completionHandler: nil)
            return true
        } else {
            let isOpened = application.openURL(url)
            return isOpened
        }
    }
