Skip to content

Commit 8961d73

Browse files
authored
fix(kotlin-extensions): NPE in CloudKeyContainer.getOrNull(...) (#754)
1 parent 630c43c commit 8961d73

File tree

1 file changed

+3
-3
lines changed
  • cloud-kotlin/cloud-kotlin-extensions/src/main/kotlin/org/incendo/cloud/kotlin/extension

1 file changed

+3
-3
lines changed

cloud-kotlin/cloud-kotlin-extensions/src/main/kotlin/org/incendo/cloud/kotlin/extension/CloudKeyExtensions.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import org.incendo.cloud.key.CloudKeyHolder
3535
* @return the value, or `null`
3636
*/
3737
public fun <T : Any> CloudKeyContainer.getOrNull(key: CloudKey<T>): T? =
38-
this.optional(key).orElseGet(null)
38+
this.optional(key).orElse(null)
3939

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

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

6060
/**
6161
* Creates a new key with the given [name].

0 commit comments

Comments
 (0)