From 3e2eb12e0de3e913c0349d1a24e21cc9f2c7a04b Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Tue, 16 Jul 2024 23:31:05 +0200 Subject: [PATCH] chore(cocoapods): Add a bit fault tolerance for `PODS` / `DEPENDENCIES` Failing hard is not necessary and tolerating the absence is consistent with the handling of `CHECKOUT OPTIONS` nearby. Signed-off-by: Frank Viernau --- .../package-managers/cocoapods/src/main/kotlin/Lockfile.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/package-managers/cocoapods/src/main/kotlin/Lockfile.kt b/plugins/package-managers/cocoapods/src/main/kotlin/Lockfile.kt index af5458031163e..bb2f7b1d07de8 100644 --- a/plugins/package-managers/cocoapods/src/main/kotlin/Lockfile.kt +++ b/plugins/package-managers/cocoapods/src/main/kotlin/Lockfile.kt @@ -56,7 +56,7 @@ internal data class Lockfile( internal fun String.parseLockfile(): Lockfile { val root = Yaml.default.parseToYamlNode(this).yamlMap - val pods = root.get("PODS")!!.items.map { it.toPod() } + val pods = root.get("PODS")?.items.orEmpty().map { it.toPod() } val checkoutOptions = root.get("CHECKOUT OPTIONS")?.entries.orEmpty().map { val name = it.key.content @@ -70,7 +70,7 @@ internal fun String.parseLockfile(): Lockfile { name to checkoutOption }.toMap() - val dependencies = root.get("DEPENDENCIES")!!.items.map { node -> + val dependencies = root.get("DEPENDENCIES")?.items.orEmpty().map { node -> val (name, version) = parseNameAndVersion(node.yamlScalar.content) Dependency(name, version) }