aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/util
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-08-31 18:19:06 +0200
committernea <nea@nea.moe>2023-08-31 18:19:06 +0200
commitb7b01f1c6fbf889ae9bfcdb5b34c5ccfa48d5ba0 (patch)
tree535b601405763736109be9ff281a71c06155b52f /src/main/kotlin/moe/nea/firmament/util
parentba72aedf7fb98c1ec72a8745402f577fb0024508 (diff)
downloadfirmament-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.kt7
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()
}