[gnome-shell] appDisplay: Fix dead error handling



commit 941419e165d60c0a95d4e73310f4f88b1a03a5d3
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Aug 13 03:02:05 2021 +0200

    appDisplay: Fix dead error handling
    
    gjs includes an override to turn GSettings' asserts into exceptions,
    but we'll have to catch that instead of checking for a null return
    value.
    
    Spotted by coverity in CID 351268.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>

 js/ui/appDisplay.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 012e88bd0b..3673c85416 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1831,11 +1831,13 @@ class AppDisplay extends BaseAppView {
 
         // Create the new folder
         let newFolderPath = this._folderSettings.path.concat('folders/', newFolderId, '/');
-        let newFolderSettings = new Gio.Settings({
-            schema_id: 'org.gnome.desktop.app-folders.folder',
-            path: newFolderPath,
-        });
-        if (!newFolderSettings) {
+        let newFolderSettings;
+        try {
+            newFolderSettings = new Gio.Settings({
+                schema_id: 'org.gnome.desktop.app-folders.folder',
+                path: newFolderPath,
+            });
+        } catch (e) {
             log('Error creating new folder');
             return false;
         }


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