File tree 1 file changed +10
-2
lines changed
app/src/main/java/fr/free/nrw/commons/contributions
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,10 @@ public void onSaveInstanceState(@NonNull Bundle outState) {
199
199
}else if (layoutManager instanceof GridLayoutManager ){
200
200
lastVisibleItemPosition =((GridLayoutManager )layoutManager ).findLastCompletelyVisibleItemPosition ();
201
201
}
202
- outState .putString (VISIBLE_ITEM_ID ,findIdOfItemWithPosition (lastVisibleItemPosition ));
202
+ String idOfItemWithPosition = findIdOfItemWithPosition (lastVisibleItemPosition );
203
+ if (null != idOfItemWithPosition ) {
204
+ outState .putString (VISIBLE_ITEM_ID , idOfItemWithPosition );
205
+ }
203
206
}
204
207
205
208
@ Override
@@ -216,8 +219,13 @@ public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
216
219
* @param position
217
220
* @return
218
221
*/
222
+ @ Nullable
219
223
private String findIdOfItemWithPosition (int position ) {
220
- return callback .getContributionForPosition (position ).getContentUri ().getLastPathSegment ();
224
+ Contribution contributionForPosition = callback .getContributionForPosition (position );
225
+ if (null != contributionForPosition ) {
226
+ return contributionForPosition .getContentUri ().getLastPathSegment ();
227
+ }
228
+ return null ;
221
229
}
222
230
223
231
}
You can’t perform that action at this time.
0 commit comments