Skip to content

Commit 68ba852

Browse files
fav icon fix - if no image - set it to null....
1 parent da43f3a commit 68ba852

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/MainForm.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,11 @@ private void Manager_OnFavIconLoaded(ChromiumWebBrowser browser, byte[] iconData
522522

523523
var tab = GetTabByBrowser(browser);
524524
if (tab != null && tab.Tab != null) {
525-
var bitmap = new Bitmap(new MemoryStream(iconData));
525+
526+
Bitmap bitmap = null;
527+
if (iconData !=null){
528+
bitmap = new Bitmap(new MemoryStream(iconData));
529+
}
526530
tab.FavIcon = bitmap;
527531
tab.Tab.Image = bitmap;
528532
}

src/Managers/FavIconManager.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal static class FavIconManager {
4545
private static readonly HttpClient httpClient = new HttpClient() { Timeout = TimeSpan.FromSeconds(5) };
4646

4747

48-
static byte[] NotFound_favico { get; set; }
48+
//static byte[] NotFound_favico { get; set; }
4949

5050
public static void Init() {
5151
Path.Combine(ConfigManager.AppDataPath, "FavIcons").EnsureFolderExists();
@@ -56,7 +56,7 @@ public static void Init() {
5656
favg.FillRectangle(Brushes.Beige,0,0,favnf.Width,favnf.Height);
5757
favg.DrawString("na", new Font( SystemFonts.DefaultFont.FontFamily,7f),Brushes.Black,0,0);
5858

59-
NotFound_favico = favnf.ToByteArray(ImageFormat.Png) ;
59+
//NotFound_favico = favnf.ToByteArray(ImageFormat.Png) ;
6060

6161
}
6262

@@ -139,7 +139,8 @@ public static async void LoadFavicon(ChromiumWebBrowser browser, bool readCacheO
139139

140140
// NOT FOUND!
141141
//if you dont do this, there is residue favicon from previous Website.
142-
iconBitmap = NotFound_favico;
142+
//iconBitmap = NotFound_favico;
143+
iconBitmap = null;
143144
OnLoaded(browser, iconBitmap);
144145
return;
145146

0 commit comments

Comments
 (0)