mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
* Added null check for contribution with position in ContributionsListFragment
This commit is contained in:
parent
f605c5c13a
commit
828b5a3cd1
1 changed files with 10 additions and 2 deletions
|
|
@ -199,7 +199,10 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
|
|||
}else if(layoutManager instanceof GridLayoutManager){
|
||||
lastVisibleItemPosition=((GridLayoutManager)layoutManager).findLastCompletelyVisibleItemPosition();
|
||||
}
|
||||
outState.putString(VISIBLE_ITEM_ID,findIdOfItemWithPosition(lastVisibleItemPosition));
|
||||
String idOfItemWithPosition = findIdOfItemWithPosition(lastVisibleItemPosition);
|
||||
if (null != idOfItemWithPosition) {
|
||||
outState.putString(VISIBLE_ITEM_ID, idOfItemWithPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -216,8 +219,13 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
|
|||
* @param position
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
private String findIdOfItemWithPosition(int position) {
|
||||
return callback.getContributionForPosition(position).getContentUri().getLastPathSegment();
|
||||
Contribution contributionForPosition = callback.getContributionForPosition(position);
|
||||
if (null != contributionForPosition) {
|
||||
return contributionForPosition.getContentUri().getLastPathSegment();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue