[gnome-documents] documents: make the document object resist some methods that can fail



commit 4649b33b58457af3680863c1cb2b49b4f2eacc20
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Oct 30 02:19:49 2011 -0400

    documents: make the document object resist some methods that can fail

 src/documents.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index fe09b39..58093b4 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -259,13 +259,17 @@ LocalDocument.prototype = {
 
         this.sourceName = _("Local");
 
-        let defaultApp = Gio.app_info_get_default_for_type(this.mimeType, true);
+        let defaultApp = null;
+        if (this.mimeType)
+            defaultApp = Gio.app_info_get_default_for_type(this.mimeType, true);
+
         if (defaultApp)
             this.defaultAppName = defaultApp.get_name();
     },
 
     updateTypeDescription: function() {
-        this.typeDescription = Gio.content_type_get_description(this.mimeType);
+        if (this.mimeType)
+            this.typeDescription = Gio.content_type_get_description(this.mimeType);
     },
 
     _refreshThumbPath: function() {



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