diff --git a/Core/CommonKit/Sources/CommonKit/Utils/FileUrlBuilder.swift b/Core/CommonKit/Sources/CommonKit/Utils/FileUrlBuilder.swift index 090750b8ab..ba3482e55c 100644 --- a/Core/CommonKit/Sources/CommonKit/Utils/FileUrlBuilder.swift +++ b/Core/CommonKit/Sources/CommonKit/Utils/FileUrlBuilder.swift @@ -132,7 +132,7 @@ public final class FileUrlBuilder: FileUrlBuilderInterface { for (index, configPathComponent) in configPathComponents.enumerated() { - guard configPathComponent != requestPathComponents[index] else { continue } + guard configPathComponent != requestPathComponents[safe: index] else { continue } if configPathComponent == "*" { requestPathComponents[index] = "*" @@ -177,7 +177,9 @@ public final class FileUrlBuilder: FileUrlBuilderInterface { for (index, configPathComponent) in configPathComponents.enumerated() { guard configPathComponent != requestPathComponents[safe: index] && configPathComponent != "*" else { - controlPathComponents.append(requestPathComponents[index]) + if let component = requestPathComponents[safe: index] { + controlPathComponents.append(component) + } continue } return false