Merge pull request #441 from k3b/master

fix NullPointerExcpeption when opening "Downloads" with android-api < 23
This commit is contained in:
Christian Schabesberger 2017-02-03 12:35:52 +01:00 committed by GitHub
commit 9f0944dc5a
1 changed files with 15 additions and 1 deletions

View File

@ -84,9 +84,23 @@ public abstract class MissionsFragment extends Fragment
return v; return v;
} }
/** Added in API level 23. */
@Override @Override
public void onAttach(Context activity) { public void onAttach(Context activity) {
super.onAttach(activity); super.onAttach(activity);
// Bug: in api< 23 this is never called
// so mActivity=null
// so app crashes with nullpointer exception
mActivity = activity;
}
/** deprecated in API level 23,
* but must remain to allow compatibility with api<23 */
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mActivity = activity; mActivity = activity;
} }