From 17f24b7100541f1cb55f94cafef8d13283c92853 Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 22 Aug 2019 13:44:08 +0000 Subject: [PATCH] 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 --- PROMS/Volian.Base.Library/VlnItextSharpFont.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Base.Library/VlnItextSharpFont.cs b/PROMS/Volian.Base.Library/VlnItextSharpFont.cs index bf1772e8..57151d0f 100644 --- a/PROMS/Volian.Base.Library/VlnItextSharpFont.cs +++ b/PROMS/Volian.Base.Library/VlnItextSharpFont.cs @@ -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))