Fixed an issue that potentially causes as issue when siging into plex #865

pull/1529/head
tidusjar 7 years ago
parent a269d16bc4
commit 80bf8f6014

@ -50,16 +50,22 @@ namespace Ombi.Controllers.External
{ {
var server = await PlexApi.GetServer(result.user.authentication_token); var server = await PlexApi.GetServer(result.user.authentication_token);
var servers = server.Server.FirstOrDefault(); var servers = server.Server.FirstOrDefault();
if (servers == null)
{
_log.LogWarning("Looks like we can't find any Plex Servers");
}
settings.Enable = true; settings.Enable = true;
settings.Servers = new List<PlexServers> { new PlexServers{ settings.Servers = new List<PlexServers> {
new PlexServers
{
PlexAuthToken = result.user.authentication_token, PlexAuthToken = result.user.authentication_token,
Id = new Random().Next(), Id = new Random().Next(),
Ip = servers.LocalAddresses.Split(new []{','}, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(), Ip = servers?.LocalAddresses?.Split(new []{','}, StringSplitOptions.RemoveEmptyEntries)?.FirstOrDefault() ?? string.Empty,
MachineIdentifier = servers.MachineIdentifier, MachineIdentifier = servers?.MachineIdentifier ?? string.Empty,
Port = int.Parse(servers.Port), Port = int.Parse(servers?.Port ?? "0"),
Ssl = servers.Scheme != "http", Ssl = (servers?.Scheme ?? "http") != "http",
Name = $"Server 1", Name = "Server 1",
} }
}; };
//var serverNumber = 0; //var serverNumber = 0;

Loading…
Cancel
Save