1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-03 17:13:50 +00: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

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)
{