articlepager.getitem: handle index out of bounds (not sure how would pager respond but w/e)

This commit is contained in:
Andrew Dolgov 2017-06-06 21:58:31 +03:00
parent 5d746b07f0
commit d5871ce245
2 changed files with 13 additions and 8 deletions

View File

@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.fox.ttrss"
android:versionCode="444"
android:versionName="1.210">
android:versionCode="445"
android:versionName="1.211">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

View File

@ -52,14 +52,19 @@ public class ArticlePager extends Fragment {
@Override
public Fragment getItem(int position) {
Article article = m_articles.get(position);
try {
Article article = m_articles.get(position);
if (article != null) {
ArticleFragment af = new ArticleFragment();
af.initialize(article);
if (article != null) {
ArticleFragment af = new ArticleFragment();
af.initialize(article);
return af;
return af;
}
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
return null;
}