1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-27 17:08:00 +01:00

check for empty string on malformed URL (#944)

* treat empty string host as null

* use `string.IsNullOrEmpty`
This commit is contained in:
Kyle Spearrin 2020-06-01 14:46:37 -04:00 committed by GitHub
parent f8c7285f56
commit 24547e67bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,13 +36,14 @@ namespace Bit.Core.Utilities
public static string GetHostname(string uriString)
{
return GetUri(uriString)?.Host;
var uri = GetUri(uriString);
return string.IsNullOrEmpty(uri?.Host) ? null : uri.Host;
}
public static string GetHost(string uriString)
{
var uri = GetUri(uriString);
if (uri != null)
if (!string.IsNullOrEmpty(uri?.Host))
{
if (uri.IsDefaultPort)
{