B2019-118 Font appears in Registry but the related file does not appear in the font folder. Results in a crash. Error Handler was added to eliminate this case

This commit is contained in:
Rich 2019-08-22 13:44:08 +00:00
parent a804f2f716
commit 17f24b7100

View File

@ -112,7 +112,15 @@ namespace Volian.Base.Library
if (name.StartsWith(fontName))
{
string fontFile = (string)FontKey.GetValue(name);
FontFactory.Register(fontFile.Contains("\\") ? fontFile : FontFind.FontDir + "\\" + fontFile);
try // B2019-118 Add error handling for FontFacory.Register (Windows Registry contains a node that
// points to a file that no longer exists
{
FontFactory.Register(fontFile.Contains("\\") ? fontFile : FontFind.FontDir + "\\" + fontFile);
}
catch (Exception ex) // catch any exception and add the error to the error log.
{
_MyLog.WarnFormat("Font Error {0} - {1}", name, ex.Message);
}
}
}
if (!FontFactory.IsRegistered(fontName))