Bug 867058 - Check bytes.length before decoding favicons. r=mfinkle

This commit is contained in:
Brian Nicholson 2013-05-23 11:42:30 -07:00
Родитель 24524349b3
Коммит 35619dbcd5
6 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -732,7 +732,7 @@ public class AwesomeBar extends GeckoActivity
}
Bitmap bitmap = null;
if (b != null) {
if (b != null && b.length > 0) {
bitmap = BitmapUtils.decodeByteArray(b);
}

Просмотреть файл

@ -874,7 +874,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
do {
final String url = c.getString(c.getColumnIndexOrThrow(Combined.URL));
final byte[] b = c.getBlob(c.getColumnIndexOrThrow(Combined.FAVICON));
if (b == null)
if (b == null || b.length == 0)
continue;
Bitmap favicon = BitmapUtils.decodeByteArray(b);

Просмотреть файл

@ -343,7 +343,7 @@ public class BookmarksTab extends AwesomeBarTab {
byte[] b = cursor.getBlob(cursor.getColumnIndexOrThrow(URLColumns.FAVICON));
Bitmap favicon = null;
if (b != null) {
if (b != null && b.length > 0) {
Bitmap bitmap = BitmapUtils.decodeByteArray(b);
if (bitmap != null) {
favicon = Favicons.getInstance().scaleImage(bitmap);

Просмотреть файл

@ -191,7 +191,7 @@ public class HistoryTab extends AwesomeBarTab {
byte[] b = (byte[]) historyItem.get(URLColumns.FAVICON);
Bitmap favicon = null;
if (b != null) {
if (b != null && b.length > 0) {
Bitmap bitmap = BitmapUtils.decodeByteArray(b);
if (bitmap != null) {
favicon = Favicons.getInstance().scaleImage(bitmap);

Просмотреть файл

@ -711,7 +711,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
byte[] b = c.getBlob(faviconIndex);
c.close();
if (b == null)
if (b == null || b.length == 0)
return null;
return BitmapUtils.decodeByteArray(b);

Просмотреть файл

@ -657,7 +657,7 @@ public class TopSitesView extends GridView {
final byte[] b = c.getBlob(c.getColumnIndexOrThrow(Thumbnails.DATA));
Bitmap bitmap = null;
if (b != null) {
if (b != null && b.length > 0) {
bitmap = BitmapUtils.decodeByteArray(b);
}
c.close();