From 55317b5c749a36411f6582f8cf6a9477f1a2c880 Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Fri, 13 Dec 2019 13:45:04 +0000 Subject: [PATCH] Fixing index error & split out code for readability --- .../Data/SqliteItemRepository.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 2a74a826b9..b664738cb5 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -4596,14 +4596,19 @@ namespace Emby.Server.Implementations.Data var paramName = "@ExcludeInheritedTags"; if (statement == null) { - int index = 0; - whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + string.Join(",", query.ExcludeInheritedTags.Select(t => paramName + index++)) + ")) is null)"); + List paramList = new List(); + for (int index = 0; index < query.ExcludeInheritedTags.Length; index++) + { + paramList.Add(paramName + index); + } + + whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + string.Join(",", paramList) + ")) is null)"); } else { for (int index = 0; index < query.ExcludeInheritedTags.Length; index++) { - statement.TryBind(paramName + index, GetCleanValue(query.ExcludeInheritedTags[0])); + statement.TryBind(paramName + index, GetCleanValue(query.ExcludeInheritedTags[index])); } } }