fix crash if sdcard is unmounted and feed icons are enabled (closes

#749)
This commit is contained in:
Andrew Dolgov 2013-07-19 13:07:27 +04:00
parent 6b431f01f4
commit e2b195e5ed
3 changed files with 26 additions and 18 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="191" android:versionCode="192"
android:versionName="1.8.11" > android:versionName="1.8.12" >
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"

View File

@ -517,6 +517,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
if (m_enableFeedIcons) { if (m_enableFeedIcons) {
try {
File storage = m_activity.getExternalCacheDir(); File storage = m_activity.getExternalCacheDir();
File iconFile = new File(storage.getAbsolutePath() + ICON_PATH + feed.id + ".ico"); File iconFile = new File(storage.getAbsolutePath() + ICON_PATH + feed.id + ".ico");
@ -528,6 +529,9 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
} else { } else {
icon.setImageResource(feed.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw); icon.setImageResource(feed.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
} }
} catch (NullPointerException e) {
icon.setImageResource(feed.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
}
} else { } else {
icon.setImageResource(feed.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw); icon.setImageResource(feed.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);

View File

@ -297,6 +297,7 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
if (m_enableFeedIcons) { if (m_enableFeedIcons) {
try {
File storage = Environment.getExternalStorageDirectory(); File storage = Environment.getExternalStorageDirectory();
File iconFile = new File(storage.getAbsolutePath() + ICON_PATH + cursor.getInt(cursor.getColumnIndex(BaseColumns._ID)) + ".ico"); File iconFile = new File(storage.getAbsolutePath() + ICON_PATH + cursor.getInt(cursor.getColumnIndex(BaseColumns._ID)) + ".ico");
@ -308,6 +309,9 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
} else { } else {
icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw); icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
} }
} catch (NullPointerException e) {
icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
}
} else { } else {
icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw); icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);