diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 15a4ab3180..3ae28fadf4 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -1073,10 +1073,7 @@ namespace Emby.Server.Implementations.Data
}
// Extremely unlikely, but somehow one or more of the image strings were malformed. Cut the array.
- var newResult = new ItemImageInfo[position];
- Array.Copy(result, newResult, position);
-
- return newResult;
+ return result[..position];
}
private void AppendItemImageInfo(StringBuilder bldr, ItemImageInfo image)
diff --git a/MediaBrowser.Common/Extensions/StringBuilderExtensions.cs b/MediaBrowser.Common/Extensions/StringBuilderExtensions.cs
index 0e0bc4282e..75d654f23b 100644
--- a/MediaBrowser.Common/Extensions/StringBuilderExtensions.cs
+++ b/MediaBrowser.Common/Extensions/StringBuilderExtensions.cs
@@ -17,7 +17,8 @@ namespace MediaBrowser.Common.Extensions
/// The updated string builder.
public static StringBuilder AppendJoinInSingleQuotes(this StringBuilder builder, char delimiter, IReadOnlyList values)
{
- for (var i = 0; i < values.Count; i++)
+ var len = values.Count;
+ for (var i = 0; i < len; i++)
{
builder.Append('\'')
.Append(values[i])