mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1300484 - IconDownloader: Check if best bitmap is not null. r=ahunt
MozReview-Commit-ID: 7A1u6EefKt9 --HG-- extra : rebase_source : 36334c8dd49dcdbdf3f34edc633604d058112fb1
This commit is contained in:
parent
d2fd8a9859
commit
c3c4c19eb4
@ -5,6 +5,7 @@
|
||||
package org.mozilla.gecko.icons.decoders;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
@ -77,6 +78,7 @@ public class LoadFaviconResult {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Bitmap getBestBitmap(int targetWidthAndHeight) {
|
||||
final SparseArray<Bitmap> iconMap = new SparseArray<>();
|
||||
final List<Integer> sizes = new ArrayList<>();
|
||||
|
@ -6,6 +6,7 @@
|
||||
package org.mozilla.gecko.icons.loader;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.util.Log;
|
||||
|
||||
@ -60,9 +61,12 @@ public class IconDownloader implements IconLoader {
|
||||
return null;
|
||||
}
|
||||
|
||||
return IconResponse.createFromNetwork(
|
||||
result.getBestBitmap(request.getTargetSize()),
|
||||
iconUrl);
|
||||
final Bitmap bitmap = result.getBestBitmap(request.getTargetSize());
|
||||
if (bitmap == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return IconResponse.createFromNetwork(bitmap, iconUrl);
|
||||
} catch (Exception e) {
|
||||
Log.e(LOGTAG, "Error reading favicon", e);
|
||||
} catch (OutOfMemoryError e) {
|
||||
|
Loading…
Reference in New Issue
Block a user