diff options
author | nea <nea@nea.moe> | 2023-08-31 18:19:06 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-08-31 18:19:06 +0200 |
commit | b7b01f1c6fbf889ae9bfcdb5b34c5ccfa48d5ba0 (patch) | |
tree | 535b601405763736109be9ff281a71c06155b52f /src/main/kotlin/moe/nea/firmament/util | |
parent | ba72aedf7fb98c1ec72a8745402f577fb0024508 (diff) | |
download | firmament-b7b01f1c6fbf889ae9bfcdb5b34c5ccfa48d5ba0.tar.gz firmament-b7b01f1c6fbf889ae9bfcdb5b34c5ccfa48d5ba0.tar.bz2 firmament-b7b01f1c6fbf889ae9bfcdb5b34c5ccfa48d5ba0.zip |
Fix profile viewer for missing uuid pets
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/assertions.kt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/assertions.kt b/src/main/kotlin/moe/nea/firmament/util/assertions.kt index 2e2e01a..5505422 100644 --- a/src/main/kotlin/moe/nea/firmament/util/assertions.kt +++ b/src/main/kotlin/moe/nea/firmament/util/assertions.kt @@ -9,8 +9,11 @@ package moe.nea.firmament.util /** * Less aggressive version of `require(obj != null)`, which fails in devenv but continues at runtime. */ -inline fun <T : Any> assertNotNullOr(obj: T?, block: () -> T): T { - assert(obj != null) +inline fun <T : Any> assertNotNullOr(obj: T?, message: String? = null, block: () -> T): T { + if (message == null) + assert(obj != null) + else + assert(obj != null) { message } return obj ?: block() } |