From 6131beead68f772e1d4970e4258d019be479f7c2 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 2 Apr 2025 12:05:43 +0100 Subject: [PATCH] breakManager: Fix a potential null object dereference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There’s no `else` branch above, so it’s possible for `this._notification` to be `null` at the bottom of the function (especially if the user has explicitly closed the previous notification), so handle that. Signed-off-by: Philip Withnall Helps: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8280 Part-of: --- js/misc/breakManager.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/misc/breakManager.js b/js/misc/breakManager.js index 42e7c3569..371201a7a 100644 --- a/js/misc/breakManager.js +++ b/js/misc/breakManager.js @@ -1278,8 +1278,11 @@ class BreakNotificationSource extends GObject.Object { this._scheduleUpdateState(updateTimeoutSeconds); } - this._notification.urgency = this._urgencyForBreakType(this._manager.currentBreakType); - this._source.addNotification(this._notification); + if (this._notification) { + this._notification.urgency = this._urgencyForBreakType(this._manager.currentBreakType); + this._source.addNotification(this._notification); + } + break; }