diff options
author | Andy Scherzinger <info@andy-scherzinger.de> | 2022-04-17 19:39:29 +0300 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2022-04-19 18:09:16 +0300 |
commit | 746c3a8a4e9a2bebf9f4a1d1c0e142f162b662b1 (patch) | |
tree | 6d72b6242b108ef4f48fd2725cf701e2f46eb1d9 | |
parent | 29161be3f1b72d4d2604c89ea2ad224fb54b0857 (diff) |
catch NPE when UI is already teared down
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
-rw-r--r-- | app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java b/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java index 47f119d6e..11eb21ec4 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java @@ -213,6 +213,7 @@ public class ChooseAccountDialogFragment extends DialogFragment { @Override public void onSubscribe(@NonNull Disposable d) { + // unused atm } @Override @@ -221,8 +222,12 @@ public class ChooseAccountDialogFragment extends DialogFragment { status = statusOverall.getOcs().getData(); } - binding.setStatus.setEnabled(true); - drawStatus(); + try { + binding.setStatus.setEnabled(true); + drawStatus(); + } catch (NullPointerException npe) { + Log.i(TAG, "UI already teared down", npe); + } } @Override @@ -232,6 +237,7 @@ public class ChooseAccountDialogFragment extends DialogFragment { @Override public void onComplete() { + // unused atm } }); } @@ -279,12 +285,12 @@ public class ChooseAccountDialogFragment extends DialogFragment { null) .subscribe(new Observer<UserEntity>() { @Override - public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) { - // unused at the moment + public void onSubscribe(@NonNull Disposable d) { + // unused atm } @Override - public void onNext(@io.reactivex.annotations.NonNull UserEntity userEntity) { + public void onNext(@NonNull UserEntity userEntity) { cookieManager.getCookieStore().removeAll(); userUtils.disableAllUsersWithoutId(userEntity.getId()); if (getActivity() != null) { @@ -295,13 +301,13 @@ public class ChooseAccountDialogFragment extends DialogFragment { } @Override - public void onError(@io.reactivex.annotations.NonNull Throwable e) { + public void onError(@NonNull Throwable e) { Log.w(TAG, "Error updating user", e); } @Override public void onComplete() { - // DONE + // unused atm } }); } |