Skip to content

Commit

Permalink
Update LiveEvent.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
ueen authored Jan 18, 2020
1 parent f9f19ae commit a7fd6ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions liveevent/src/main/java/de/ueen/liveevent/LiveEvent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class LiveEvent<T>: MediatorLiveData<LiveEvent.Once<T>>() {
fun observe(owner: LifecycleOwner, onEvent: (T) -> Unit) {
this.value = null
this.observe(owner, Observer {
if (it != null && it.receive(onEvent.hashCode()) && it.message != null) {
onEvent(it.message)
if (it != null && it.receive(onEvent.hashCode())) {
onEvent(it.message?:0)
}
})
}
Expand All @@ -45,4 +45,4 @@ class LiveEvent<T>: MediatorLiveData<LiveEvent.Once<T>>() {
}
}

}
}

0 comments on commit a7fd6ec

Please sign in to comment.