mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-23 00:06:27 +00:00
Improved error message
This commit is contained in:
parent
9db4011c47
commit
7a486e4426
1 changed files with 10 additions and 15 deletions
|
@ -249,22 +249,17 @@ 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" +
|
||||
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;
|
||||
}
|
||||
if (fragment.getContext() == null) {
|
||||
Log.w("Fragment without context" +
|
||||
" task=" + name +
|
||||
" fragment=" + fragment.getClass().getName() +
|
||||
" lifecycle=" + owner.getLifecycle().getCurrentState());
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue