[gnome-shell] Fix crash in runDialog



commit 2a0e0ae66fcf2f523b10b9a8b009ea39b69c8dcf
Author: Maxim Ermilov <zaspire rambler ru>
Date:   Sat Dec 19 06:41:05 2009 +0100

    Fix crash in runDialog
    
    The run dialog crashes when PATH contains non-existing directories (some
    distros seem to do that ...).
    Fix by filtering those out before setting up file monitors.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=606418

 js/ui/runDialog.js |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 6f98738..6465a6e 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -42,7 +42,14 @@ CommandCompleter.prototype = {
         for (let i = 0; i < this._paths.length; i++) {
             this._childs[i] = [];
             let file = Gio.file_new_for_path(this._paths[i]);
-            let info = file.query_info(Gio.FILE_ATTRIBUTE_STANDARD_TYPE, Gio.FileQueryInfoFlags.NONE, null);
+            let info;
+            try {
+                info = file.query_info(Gio.FILE_ATTRIBUTE_STANDARD_TYPE, Gio.FileQueryInfoFlags.NONE, null);
+            } catch (e) {
+                // FIXME catchall
+                this._paths[i] = null;
+                continue;
+            }
 
             if (info.get_attribute_uint32(Gio.FILE_ATTRIBUTE_STANDARD_TYPE) != Gio.FileType.DIRECTORY)
                 continue;
@@ -53,6 +60,9 @@ CommandCompleter.prototype = {
                 this._monitors[i].connect("changed", Lang.bind(this, this._onChanged));
             }
         }
+        this._paths = this._paths.filter(function(a) {
+            return a != null;
+        });
         this._update(0);
     },
 



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