Skip to content

Commit f66d02c

Browse files
domdomeggneslihanturan
authored andcommitted
Fix commons-app#2123: Remove unnecessary calls to getParentFragment() to avoid NPE (commons-app#2138)
1 parent 174e58c commit f66d02c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/fr/free/nrw/commons/media/MediaDetailPagerFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public void notifyDataSetChanged(){
343343

344344
@Override
345345
public void onPageScrolled(int i, float v, int i2) {
346-
if(getParentFragment().getActivity() == null) {
346+
if(getActivity() == null) {
347347
Timber.d("Returning as activity is destroyed!");
348348
return;
349349
}
@@ -398,7 +398,7 @@ public MediaDetailAdapter(FragmentManager fm) {
398398
public Fragment getItem(int i) {
399399
if (i == 0) {
400400
// See bug https://code.google.com/p/android/issues/detail?id=27526
401-
if(getParentFragment().getActivity() == null) {
401+
if(getActivity() == null) {
402402
Timber.d("Skipping getItem. Returning as activity is destroyed!");
403403
return null;
404404
}

0 commit comments

Comments
 (0)