Fix loading of icons if archive file doesn't exist

This commit is contained in:
Pat Hartl 2023-08-28 18:43:36 -05:00
parent b59b0eca0e
commit 1def1ce0e8

View file

@ -121,6 +121,8 @@ namespace LANCommander.Services
else else
{ {
#if WINDOWS #if WINDOWS
try
{
if (game.Archives == null || game.Archives.Count == 0) if (game.Archives == null || game.Archives.Count == 0)
throw new FileNotFoundException(); throw new FileNotFoundException();
@ -128,8 +130,6 @@ namespace LANCommander.Services
Bitmap bitmap = null; Bitmap bitmap = null;
try
{
var iconReference = ArchiveService.ReadFile(archive.ObjectKey, game.Icon); var iconReference = ArchiveService.ReadFile(archive.ObjectKey, game.Icon);
if (IsWinPEFile(iconReference)) if (IsWinPEFile(iconReference))
@ -156,10 +156,13 @@ namespace LANCommander.Services
return iconPng; return iconPng;
} }
catch (Exception ex) { } catch (Exception ex)
#endif {
}
return File.ReadAllBytes("favicon.png"); return File.ReadAllBytes("favicon.png");
#endif
} }
} }