diff --git a/src/Jackett.Common/Utils/Extensions.cs b/src/Jackett.Common/Utils/Extensions.cs index 813261f86..0de08f589 100644 --- a/src/Jackett.Common/Utils/Extensions.cs +++ b/src/Jackett.Common/Utils/Extensions.cs @@ -64,8 +64,11 @@ namespace Jackett.Common.Utils // IEnumerable class above already does this. All ICollection are IEnumerable, so favor IEnumerable? public static bool IsEmpty(this ICollection obj) => obj.Count == 0; - - public static bool IsEmptyOrNull(this ICollection obj) => obj?.IsEmpty() == true; + // obj == null || obj.IsEmpty() causes VS to suggest merging sequential checks + // the result is obj?.IsEmpty() == true which returns false when null + // Other options are obj?.IsEmpty() == true || obj == null Or (obj?.IsEmpty()).GetValueOrDefault(true) + // All three options remove the suggestion and give the intended result of this function + public static bool IsEmptyOrNull(this ICollection obj) => obj?.IsEmpty() ?? true; } public static class XElementExtension