From e442e9daf632d2ceb276f9e254d5850a33f91667 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 6 Sep 2023 09:23:51 -0400 Subject: [PATCH] backgroundApps: Don't crash if app id can't be looked up I'm looking at a log file with this trace back: JS ERROR: TypeError: a.app is null _sync/<@resource:///org/gnome/shell/ui/status/backgroundApps.js:226:17 _sync@resource:///org/gnome/shell/ui/status/backgroundApps.js:225:14 _init/ 0); } _sync() { this._syncVisibility(); if (!this._proxy) return; const {BackgroundApps: backgroundApps} = this._proxy; this._appsSection.removeAll(); const items = new Map(); (backgroundApps ?? []) .map(backgroundApp => { const appId = backgroundApp.app_id.deepUnpack(); const app = this._appSystem.lookup_app(`${appId}.desktop`); const message = backgroundApp.message?.deepUnpack(); return {app, message}; }) + .filter(backgroundApp => backgroundApp.app) .sort((a, b) => { return a.app.get_name().localeCompare(b.app.get_name()); }) .forEach(backgroundApp => { const {app, message} = backgroundApp; let item = items.get(app); if (!item) { item = new BackgroundAppMenuItem(app); items.set(app, item); this._appsSection.addMenuItem(item); } if (message) item.set({message}); }); const nBackgroundApps = items.size; this.title = nBackgroundApps === 0 ? _('No Background Apps') : ngettext( '%d Background App', '%d Background Apps', nBackgroundApps).format(nBackgroundApps); this._listTitle.visible = nBackgroundApps > 0; } vfunc_clicked() { this.menu.open(); } -- 2.41.0