Browse Source

Fixed crash when invalid font file is present in Data Entry Screen

frogsoftware 2 months ago
parent
commit
3657924e16
1 changed files with 9 additions and 2 deletions
  1. 9 2
      prs.desktop/Panels/DataEntry/DocumentViewList.cs

+ 9 - 2
prs.desktop/Panels/DataEntry/DocumentViewList.cs

@@ -132,8 +132,15 @@ public abstract class DocumentViewList<TDocument> : UserControl, INotifyProperty
             var fontfile = Path.Combine(tesseractpath, "ARIALUNI.ttf");
             if (File.Exists(fontfile))
             {
-                using (var fontStream = new FileStream(fontfile, FileMode.Open))
-                    processor.UnicodeFont = new PdfTrueTypeFont(fontStream, 8);
+                try
+                {
+                    using (var fontStream = new FileStream(fontfile, FileMode.Open))
+                        processor.UnicodeFont = new PdfTrueTypeFont(fontStream, 8);
+                }
+                catch (Exception e)
+                {
+                    Logger.Send(LogType.Error,"",$"Unable to Load ARIALUNI.TTF: {e.Message}\n{e.StackTrace}");
+                }
             }
         }