fix crash if sdcard is unmounted and feed icons are enabled (closes
#749)
This commit is contained in:
parent
6b431f01f4
commit
e2b195e5ed
@ -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"
|
||||||
|
@ -517,15 +517,19 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
|||||||
|
|
||||||
if (m_enableFeedIcons) {
|
if (m_enableFeedIcons) {
|
||||||
|
|
||||||
File storage = m_activity.getExternalCacheDir();
|
try {
|
||||||
|
File storage = m_activity.getExternalCacheDir();
|
||||||
File iconFile = new File(storage.getAbsolutePath() + ICON_PATH + feed.id + ".ico");
|
|
||||||
if (iconFile.exists()) {
|
File iconFile = new File(storage.getAbsolutePath() + ICON_PATH + feed.id + ".ico");
|
||||||
Bitmap bmpOrig = BitmapFactory.decodeFile(iconFile.getAbsolutePath());
|
if (iconFile.exists()) {
|
||||||
if (bmpOrig != null) {
|
Bitmap bmpOrig = BitmapFactory.decodeFile(iconFile.getAbsolutePath());
|
||||||
icon.setImageBitmap(bmpOrig);
|
if (bmpOrig != null) {
|
||||||
|
icon.setImageBitmap(bmpOrig);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
icon.setImageResource(feed.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (NullPointerException e) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,15 +297,19 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
|
|||||||
|
|
||||||
if (m_enableFeedIcons) {
|
if (m_enableFeedIcons) {
|
||||||
|
|
||||||
File storage = Environment.getExternalStorageDirectory();
|
try {
|
||||||
|
File storage = Environment.getExternalStorageDirectory();
|
||||||
File iconFile = new File(storage.getAbsolutePath() + ICON_PATH + cursor.getInt(cursor.getColumnIndex(BaseColumns._ID)) + ".ico");
|
|
||||||
if (iconFile.exists()) {
|
File iconFile = new File(storage.getAbsolutePath() + ICON_PATH + cursor.getInt(cursor.getColumnIndex(BaseColumns._ID)) + ".ico");
|
||||||
Bitmap bmpOrig = BitmapFactory.decodeFile(iconFile.getAbsolutePath());
|
if (iconFile.exists()) {
|
||||||
if (bmpOrig != null) {
|
Bitmap bmpOrig = BitmapFactory.decodeFile(iconFile.getAbsolutePath());
|
||||||
icon.setImageBitmap(bmpOrig);
|
if (bmpOrig != null) {
|
||||||
|
icon.setImageBitmap(bmpOrig);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (NullPointerException e) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user