Skip to content

Commit

Permalink
chore(cocoapods): Add a bit fault tolerance for PODS / DEPENDENCIES
Browse files Browse the repository at this point in the history
Failing hard is not necessary and tolerating the absence is consistent
with the handling of `CHECKOUT OPTIONS` nearby.

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau authored and sschuberth committed Jul 17, 2024
1 parent 41c5bca commit 3e2eb12
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal data class Lockfile(

internal fun String.parseLockfile(): Lockfile {
val root = Yaml.default.parseToYamlNode(this).yamlMap
val pods = root.get<YamlList>("PODS")!!.items.map { it.toPod() }
val pods = root.get<YamlList>("PODS")?.items.orEmpty().map { it.toPod() }

val checkoutOptions = root.get<YamlMap>("CHECKOUT OPTIONS")?.entries.orEmpty().map {
val name = it.key.content
Expand All @@ -70,7 +70,7 @@ internal fun String.parseLockfile(): Lockfile {
name to checkoutOption
}.toMap()

val dependencies = root.get<YamlList>("DEPENDENCIES")!!.items.map { node ->
val dependencies = root.get<YamlList>("DEPENDENCIES")?.items.orEmpty().map { node ->
val (name, version) = parseNameAndVersion(node.yamlScalar.content)
Dependency(name, version)
}
Expand Down

0 comments on commit 3e2eb12

Please sign in to comment.