[gnome-shell-extensions/gnome-3-8] places-menu: null-check g_volume_get_identifier()



commit fa30f936150da8a265aacef1906fbcd438d1e0bf
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon Jun 17 21:36:56 2013 +0200

    places-menu: null-check g_volume_get_identifier()
    
    Not all volumes have the 'class' identifier (for example MTP doesn't),
    and we can't apply indexOf on null.

 extensions/places-menu/placeDisplay.js |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index 6d0625b..a501494 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -292,8 +292,9 @@ const PlacesManager = new Lang.Class({
             let volumes = drives[i].get_volumes();
 
             for(let j = 0; j < volumes.length; j++) {
-                if (volumes[j].get_identifier('class').indexOf('network') >= 0) {
-                    networkVolumes.push(volumes[i]);
+                let identifier = volumes[j].get_identifier('class');
+                if (identifier && identifier.indexOf('network') >= 0) {
+                    networkVolumes.push(volumes[j]);
                 } else {
                     let mount = volumes[j].get_mount();
                     if(mount != null)
@@ -308,7 +309,8 @@ const PlacesManager = new Lang.Class({
             if(volumes[i].get_drive() != null)
                 continue;
 
-            if (volumes[i].get_identifier('class').indexOf('network') >= 0) {
+            let identifier = volumes[i].get_identifier('class');
+            if (identifier && identifier.indexOf('network') >= 0) {
                 networkVolumes.push(volumes[i]);
             } else {
                 let mount = volumes[i].get_mount();


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