mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 837373 - Check for valid favicon before scaling it. r=mfinkle
This commit is contained in:
parent
58c421702e
commit
4bf7afcf81
@ -309,7 +309,7 @@ public class Favicons {
|
||||
String storedFaviconUrl = getFaviconUrlForPageUrl(mPageUrl);
|
||||
if (storedFaviconUrl != null && storedFaviconUrl.equals(mFaviconUrl)) {
|
||||
image = loadFaviconFromDb();
|
||||
if (image != null)
|
||||
if (image != null && image.getWidth() > 0 && image.getHeight() > 0)
|
||||
return scaleImage(image);
|
||||
}
|
||||
|
||||
|
@ -804,7 +804,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
continue;
|
||||
|
||||
Bitmap favicon = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
if (favicon == null)
|
||||
if (favicon == null || favicon.getWidth() <= 0 || favicon.getHeight() <= 0)
|
||||
continue;
|
||||
|
||||
favicon = Favicons.getInstance().scaleImage(favicon);
|
||||
|
@ -89,13 +89,14 @@ abstract public class AwesomeBarTab {
|
||||
|
||||
protected void updateFavicon(ImageView faviconView, Cursor cursor) {
|
||||
byte[] b = cursor.getBlob(cursor.getColumnIndexOrThrow(URLColumns.FAVICON));
|
||||
if (b == null) {
|
||||
faviconView.setImageDrawable(null);
|
||||
} else {
|
||||
Bitmap favicon = null;
|
||||
if (b != null) {
|
||||
Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
bitmap = Favicons.getInstance().scaleImage(bitmap);
|
||||
updateFavicon(faviconView, bitmap);
|
||||
if (bitmap != null && bitmap.getWidth() > 0 && bitmap.getHeight() > 0) {
|
||||
favicon = Favicons.getInstance().scaleImage(bitmap);
|
||||
}
|
||||
}
|
||||
updateFavicon(faviconView, favicon);
|
||||
}
|
||||
|
||||
protected void updateFavicon(ImageView faviconView, Bitmap bitmap) {
|
||||
|
Loading…
Reference in New Issue
Block a user