Skip to content

Commit fb7100b

Browse files
committed
Avoid rare NPEs
1 parent 576ecf7 commit fb7100b

File tree

1 file changed

+2
-2
lines changed
  • interfaces/src/main/kotlin/com/noxcrew/interfaces/properties

1 file changed

+2
-2
lines changed

interfaces/src/main/kotlin/com/noxcrew/interfaces/properties/LazyProperty.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public abstract class LazyProperty<T : Any>(
7272

7373
// If we have recently refreshed, re-use the value!
7474
if (lastRefresh.plus(debounce.toJavaDuration()) > Instant.now()) {
75-
return value!!
75+
return value ?: load(reload)
7676
}
7777
lastRefresh = Instant.now()
7878

@@ -95,7 +95,7 @@ public abstract class LazyProperty<T : Any>(
9595
updateJob = null
9696
}
9797
updateJob?.await()
98-
return value!!
98+
return value ?: load(reload)
9999
}
100100

101101
/** Returns the value of this property. */

0 commit comments

Comments
 (0)