Fix loading of icons if archive file doesn't exist

dhcp-server
Pat Hartl 2023-08-28 18:43:36 -05:00
parent b59b0eca0e
commit 1def1ce0e8
1 changed files with 12 additions and 9 deletions

View File

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