appDisplay: Fix folder loop in _ensureDefaultFolders

In testing on Fedora, gnome-shell crashes here:

JS ERROR: TypeError: DEFAULT_FOLDERS[folder] is undefined

This needs to be a "for of" loop, not a "for in" loop, because
`folders` is an array of the hash's keys, not the hash itself.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2238>
This commit is contained in:
Adam Williamson 2022-03-09 16:12:36 -08:00 committed by Marge Bot
parent c1d13fb471
commit 0db64d3562

View File

@ -1467,7 +1467,7 @@ class AppDisplay extends BaseAppView {
this._folderSettings.set_strv('folder-children', folders); this._folderSettings.set_strv('folder-children', folders);
const { path } = this._folderSettings; const { path } = this._folderSettings;
for (const folder in folders) { for (const folder of folders) {
const { name, categories, apps } = DEFAULT_FOLDERS[folder]; const { name, categories, apps } = DEFAULT_FOLDERS[folder];
const child = new Gio.Settings({ const child = new Gio.Settings({
schema_id: 'org.gnome.desktop.app-folders.folder', schema_id: 'org.gnome.desktop.app-folders.folder',