[meld] Handle querying missing file for language



commit 06f31310a800416e4d0d14d685ea5172ee0beaa3
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Wed Jun 5 06:07:56 2013 +1000

    Handle querying missing file for language

 meld/util/sourceviewer.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/meld/util/sourceviewer.py b/meld/util/sourceviewer.py
index 82224bb..e3249c1 100644
--- a/meld/util/sourceviewer.py
+++ b/meld/util/sourceviewer.py
@@ -92,7 +92,10 @@ class _gtksourceview2(_srcviewer):
 
     def get_language_from_file(self, filename):
         f = gio.File(filename)
-        info = f.query_info(gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)
+        try:
+            info = f.query_info(gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)
+        except gio.Error:
+            return None
         content_type = info.get_content_type()
         return self.get_language_manager().guess_language(filename,
                                                           content_type)


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