Skip to content

Commit

Permalink
fix (hopefully) weird app crash on android 8
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Development committed Jan 28, 2018
1 parent 7aea76c commit 6bf2b45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ public static int getResourceIdForRightDefaultFeedIcon(Context context)
return R.drawable.default_feed_icon_dark;
}

public void PreCacheFavIcon(final Feed feed) {
public void PreCacheFavIcon(final Feed feed) throws IllegalStateException {
if(feed.getFaviconUrl() == null) {
Log.v(TAG, "No favicon for "+feed.getFeedTitle());
return;
}

Log.v(TAG, "Loading image: " + feed.getFaviconUrl());
ImageLoader.getInstance().loadImage(feed.getFaviconUrl(), displayImageOptions, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ protected void onHandleWork(@NonNull Intent intent) {
List<Feed> feedList = dbConn.getListOfFeeds();
FavIconHandler favIconHandler = new FavIconHandler(this);
for(Feed feed : feedList) {
favIconHandler.PreCacheFavIcon(feed);
try {
favIconHandler.PreCacheFavIcon(feed);
} catch(IllegalStateException ex) {
Log.e(TAG, ex.getMessage());
}
}
} else if(downloadMode.equals(DownloadMode.FAVICONS_AND_PICTURES) || downloadMode.equals(DownloadMode.PICTURES_ONLY)) {
long lastId = intent.getLongExtra(LAST_ITEM_ID, 0);
Expand Down

0 comments on commit 6bf2b45

Please sign in to comment.