Skip to content

Commit

Permalink
FIX: ShuttleResult.NOT_READY is incorrectly defined.
Browse files Browse the repository at this point in the history
For inline class, bundle == null cannot be differentiated from ShuttleResult == null.
  • Loading branch information
oasisfeng committed Apr 2, 2021
1 parent 14eddaa commit a5462ea
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ class ShuttleProvider: ContentProvider() {
@Suppress("EXPERIMENTAL_FEATURE_WARNING")
inline class ShuttleResult<R>(private val bundle: Bundle?) {

companion object { internal val NOT_READY = ShuttleResult<Any>(null) }
companion object { internal val NOT_READY = ShuttleResult<Any>(Bundle()) }

fun isNotReady() = this == NOT_READY
fun isNotReady() = bundle === NOT_READY.bundle
@Suppress("UNCHECKED_CAST") fun get(): R = bundle?.get(null) as R
override fun toString() = when(this) {
NOT_READY -> "ShuttleResult{NOT_READY}"
Expand Down

0 comments on commit a5462ea

Please sign in to comment.