mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-17 15:53:42 +01:00
Code Clean up: Convert to null-coalescing operator ?? (#5845)
Co-authored-by: Cody Robibero <cody@robibe.ro> Co-authored-by: Patrick Barron <18354464+barronpm@users.noreply.github.com>
This commit is contained in:
@@ -44,12 +44,7 @@ namespace Emby.Server.Implementations.Plugins
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_httpClientFactory == null)
|
||||
{
|
||||
_httpClientFactory = _appHost.Resolve<IHttpClientFactory>();
|
||||
}
|
||||
|
||||
return _httpClientFactory;
|
||||
return _httpClientFactory ?? (_httpClientFactory = _appHost.Resolve<IHttpClientFactory>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,11 +271,7 @@ namespace Emby.Server.Implementations.Plugins
|
||||
// If no version is given, return the current instance.
|
||||
var plugins = _plugins.Where(p => p.Id.Equals(id)).ToList();
|
||||
|
||||
plugin = plugins.FirstOrDefault(p => p.Instance != null);
|
||||
if (plugin == null)
|
||||
{
|
||||
plugin = plugins.OrderByDescending(p => p.Version).FirstOrDefault();
|
||||
}
|
||||
plugin = plugins.FirstOrDefault(p => p.Instance != null) ?? plugins.OrderByDescending(p => p.Version).FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user