1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-22 15:55:57 +00:00

Improved error message

This commit is contained in:
M66B 2022-06-14 12:43:29 +02:00
parent 9db4011c47
commit 7a486e4426

View file

@ -249,21 +249,16 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
Field mFragment = owner.getClass().getDeclaredField("mFragment");
mFragment.setAccessible(true);
Fragment fragment = (Fragment) mFragment.get(owner);
if (fragment != null) {
if (fragment.getActivity() == null) {
Log.w("Fragment without activity" +
" task=" + name +
" fragment=" + fragment.getClass().getName() +
" lifecycle=" + owner.getLifecycle().getCurrentState());
return;
}
if (fragment.getContext() == null) {
Log.w("Fragment without context" +
" task=" + name +
" fragment=" + fragment.getClass().getName() +
" lifecycle=" + owner.getLifecycle().getCurrentState());
return;
}
if (fragment != null &&
(fragment.getContext() == null || fragment.getActivity() == null)) {
// Since deliver is executed for resumed fragments only, this should never happen
Log.e("Fragment without activity" +
" task=" + name +
" context=" + (fragment.getContext() != null) +
" activity=" + (fragment.getActivity() != null) +
" fragment=" + fragment.getClass().getName() +
" lifecycle=" + owner.getLifecycle().getCurrentState());
return;
}
} catch (Throwable ex) {
Log.w(ex);