mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 21:34:44 +02:00
Prevent crash
This commit is contained in:
@@ -19,7 +19,7 @@ public class TwoStateOwner implements LifecycleOwner {
|
||||
owner.getLifecycle().addObserver(new LifecycleObserver() {
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||
public void onDestroyed() {
|
||||
registry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
||||
destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -33,10 +33,15 @@ public class TwoStateOwner implements LifecycleOwner {
|
||||
}
|
||||
|
||||
void restart() {
|
||||
registry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
||||
stop();
|
||||
start();
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
if (!registry.getCurrentState().equals(Lifecycle.State.DESTROYED))
|
||||
registry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Lifecycle getLifecycle() {
|
||||
|
||||
Reference in New Issue
Block a user