[pdfmod] Catch exceptions when inserting doc



commit 86e6e8687ca64c19b371090dc09d327131495904
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Mon Mar 29 16:52:44 2010 -0700

    Catch exceptions when inserting doc
    
    If the file isn't a PDF file, or PDFSharp is unable to load it, we now
    won't crash; instead we just warn the user.  Fixes bgo#614009

 src/PdfMod/Gui/Actions.cs |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/PdfMod/Gui/Actions.cs b/src/PdfMod/Gui/Actions.cs
index ad88146..3922680 100644
--- a/src/PdfMod/Gui/Actions.cs
+++ b/src/PdfMod/Gui/Actions.cs
@@ -261,7 +261,15 @@ namespace PdfMod.Gui
             chooser.Destroy();
 
             if (response == (int)ResponseType.Ok) {
-                app.Document.AddFromUri (new Uri (filename));
+                try {
+                    app.Document.AddFromUri (new Uri (filename));
+                } catch (Exception e) {
+                    Hyena.Log.Exception (e);
+                    Hyena.Log.Error (
+                        Catalog.GetString ("Error Loading Document"),
+                        String.Format (Catalog.GetString ("There was an error loading {0}"), GLib.Markup.EscapeText (filename ?? "")), true
+                    );
+                }
             }
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]