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>
This commit is contained in:
Florian Müllner 2021-08-13 03:02:05 +02:00
parent 6f7df32b0e
commit 941419e165

View File

@ -1831,11 +1831,13 @@ class AppDisplay extends BaseAppView {
// Create the new folder // Create the new folder
let newFolderPath = this._folderSettings.path.concat('folders/', newFolderId, '/'); let newFolderPath = this._folderSettings.path.concat('folders/', newFolderId, '/');
let newFolderSettings = new Gio.Settings({ let newFolderSettings;
schema_id: 'org.gnome.desktop.app-folders.folder', try {
path: newFolderPath, newFolderSettings = new Gio.Settings({
}); schema_id: 'org.gnome.desktop.app-folders.folder',
if (!newFolderSettings) { path: newFolderPath,
});
} catch (e) {
log('Error creating new folder'); log('Error creating new folder');
return false; return false;
} }