Prevent crash

This commit is contained in:
M66B 2022-04-27 09:58:38 +02:00
parent 3664d9b656
commit 03b1c9edf5
1 changed files with 4 additions and 2 deletions

View File

@ -625,8 +625,10 @@ public class ViewModelMessages extends ViewModel {
owner.getLifecycle().addObserver(new LifecycleObserver() {
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
public void onDestroyed() {
boundary.destroy(state);
boundary = null;
if (boundary != null) {
boundary.destroy(state);
boundary = null;
}
owner.getLifecycle().removeObserver(this);
}
});