Skip to content

Commit

Permalink
fix(kotlin-extensions): NPE in CloudKeyContainer.getOrNull(...) (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
metabrixkt committed Jul 22, 2024
1 parent 630c43c commit 8961d73
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import org.incendo.cloud.key.CloudKeyHolder
* @return the value, or `null`
*/
public fun <T : Any> CloudKeyContainer.getOrNull(key: CloudKey<T>): T? =
this.optional(key).orElseGet(null)
this.optional(key).orElse(null)

/**
* Returns the value associated with the given [key], if it exists.
Expand All @@ -45,7 +45,7 @@ public fun <T : Any> CloudKeyContainer.getOrNull(key: CloudKey<T>): T? =
* @return the value, or `null`
*/
public fun <T : Any> CloudKeyContainer.getOrNull(key: String): T? =
this.optional<T>(key).orElseGet(null)
this.optional<T>(key).orElse(null)

/**
* Returns the value associated with the given [keyHolder], if it exists.
Expand All @@ -55,7 +55,7 @@ public fun <T : Any> CloudKeyContainer.getOrNull(key: String): T? =
* @return the value, or `null`
*/
public fun <T : Any> CloudKeyContainer.getOrNull(keyHolder: CloudKeyHolder<T>): T? =
this.optional<T>(keyHolder).orElseGet(null)
this.optional<T>(keyHolder).orElse(null)

/**
* Creates a new key with the given [name].
Expand Down

0 comments on commit 8961d73

Please sign in to comment.